Tips for customizing the calendar icon on a date input in Firefox versions greater than 108

Prior to version 109, Firefox allowed for the selection of the date picker's icon similar to Chromium:

input[type="date"]::-webkit-calendar-picker-indicator {
  display: none; /* Hides the icon in Chrome and Firefox < v109 */
}

This functionality has since been removed, as shown in this Codepen. Is there a workaround available?

My date inputs feature custom icons and are displaying two icons in newer versions of Firefox. Currently, I am using user agent sniffing to add a CSS class that allows me to hide my custom icon:

    const userAgent = navigator.userAgent;
    const regex = /Firefox\/(?<majorRelease>\d+(\.\d+)?)/
    const match = userAgent.match(regex)
    const FirefoxVersion = match ? Number(match.groups.majorRelease) : null
    if (FirefoxVersion > 108){
        const inputs = document.querySelectorAll('.input[type="date"]')
        inputs.forEach((el)=>{
            el.classList.add('input-date-firefox-fix')
        })
    }

Answer №1

In my search for a solution, I discovered a workaround in the settings of Firefox to access the shadow DOM:

To access the options, navigate to:

about:config

Once there, input:

devtools.inspector.showAllAnonymousContent true

After making this change, restart your browser.

Subsequently, we come across a:

button#calendar-button

However, as it is within the shadow DOM, targeting it remains a challenge...

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are some strategies for disregarding the effects of the !important rule

After incorporating some HTML and CSS styling into a third-party site, I encountered an issue where their styling was conflicting with mine, specifically due to certain !important declarations. I want to avoid this conflict without resorting to using !impo ...

Tips for allowing a position:absolute <div> to expand as though it were containing a lengthy <p>innerText

This div automatically adjusts its width to fit the content inside, even if it extends beyond the page boundaries. Is there a way to make this div expand to fill the entire width of the page without needing a paragraph? <div style="position:absolute;le ...

I decided to uninstall Bootstrap, but now I find myself unable to make any CSS changes

After attempting to uninstall Bootstrap, my application.css no longer seems to have any effect on my app. Any suggestions on how to resolve this issue? Here is a breakdown of the steps I took that led to this problem: - Removed require bootstrap from app ...

Can anyone explain why my inner div's display is set to block and it is being pushed down when its parent div has

Below is a sample of my HTML+CSS code: <div> <div class="first">text</div> <div>more text</div> </div> div { display: inline; } .first { display: block; } What's interesting is that when the first ...

Applying Bootstrap Style to an Inline Select Element: A Step-by-Step Guide

Currently working on a page layout using Thymeleaf and Bootstrap 5. I have divided the page into two parts, with this section behaving as desired: <main role="main" class="pb-3"> <br> <p>Post office ex ...

Looking to adjust line-height property for text with different line heights

I am struggling with adjusting the line-height of row-based text content in HTML enclosed in <p> tags. The challenge I'm facing is that the text could vary in length, resulting in either one or two lines. If it's a single line, it should co ...

Custom font causing vertical gaps in masonry grid layout plugin

My front page layout is arranged using the "Masonry" jQuery plugin, with each div containing an upper image div and a lower text div. The plugin is initialized like this: function use_masonry() { var container = document.querySelector( ...

Checkbox validation malfunctioning

I'm currently working on a attendance management project and one of the forms includes multiple checkboxes. I want to ensure that at least one checkbox is checked before the form can be submitted. I attempted to use Javascript for this, however, the i ...

Modifying the CSS to Image Attribute within PHP DOM: HTML Editing

Working with my WYSIWYG editor (Summernote) has brought me so close to being able to send html-encoded emails with images. The only issue is that it uses CSS widths and heights rather than img width and height attributes. <?php $html = '<p>& ...

Switch the position of the bootstrap dropdown menu to a different side

How can I move the Bootstrap dropdown menu to the left side, as shown in the screenshot below? Disregard the color differences in the code snippet and screenshots. https://i.sstatic.net/nrgHF.png https://i.sstatic.net/d24He.png <head> ...

How can we centralize an image above text within a UL element?

Is there a way to achieve the effect shown in my mockup using just one unordered list (ul) instead of having separate ul elements for images and text? Essentially, I want to display an image with associated text below it within a single ul element using CS ...

Folding animation using CSS3 and vertex manipulation

Looking to create a folding animation on a squared div with vertex? While there are examples online using Flash, I'm seeking guidance on how to achieve a similar effect using CSS3 and HTML5. Any tips or resources would be greatly appreciated. Thank y ...

Arranging multiple lines of text above several images using CSS

I'm encountering issues when trying to place multiple texts in front of multiple images. I've managed to achieve this using absolute and relative positioning, with one text above one image. However, the problem arises when I try to apply this to ...

Tips for altering the background of a video on Vonage

Hello everyone, Currently, I am incorporating the Vonage API for video calling into my project. I would like to tweak the video background - does anyone have any ideas on how to accomplish this? I eagerly await your responses! Thank you in advance! ...

What is the best way to ensure my hover caption spans the entire size of the image?

I'm currently working on creating a hover caption that adjusts itself to fit the full width and height of an image even when it is resized. I attempted to implement a jQuery solution that I came across, but unfortunately, I am struggling to get it to ...

Show the Canvas element at the back of the DIV

This particular question requires a clear explanation. My goal is to have the canvas act as a background element on the page, while the main content of the page starts in its usual position. I attempted using separate DIVs with their own Z-index values, bu ...

Is there a way to shift this modal to the right?

I am facing an issue with aligning a button modal to the right side. I attempted using bootstrap classes like : float:right, mt:20 Unfortunately, these did not have the desired effect. Below is my code snippet: <b-modal ref="my-modal" hide-fo ...

What could be causing this excessive lag?

I've been developing a new website, but the "buttons" I'm using seem to be causing significant lag. I need help resolving this issue. You can view the website here: The problematic code snippet is shown below: <td> <a href="templi ...

Creating a unique set of CSS guidelines specifically tailored for Safari browsers

Issue at Hand In my endeavor to enhance a web app by incorporating an iframe, I stumbled upon a peculiar challenge. The behavior of the iframe across devices is inconsistent, particularly on the iPhone. Consequently, I find myself in need of implementing ...

Is it possible for Selenium to interact with buttons from the LightSwitch library?

Is it possible for Selenium to interact with LightSwitch buttons? In my initial attempt, I had to locate a button styled using LightSwitch in CSS. I used By.CSSSelector to find the button. However, upon locating the button, I realized that it was utilizin ...