Positioning of the calendar icon in the date input field is problematic when in RTL direction on Chrome and various other

My date input field is causing a problem on a Hebrew (RTL) website. Strangely, in Firefox, the calendar icon displays correctly on the left side, but in Chrome and other browsers, it does not.

The code I am using is:

<input type="date" class="form-control" name="adjDate" id="adjDate">
html[dir="rtl"] .form-control[type="date"]::-webkit-calendar-picker-indicator {
  right: auto;
  left: 0;
}
document.addEventListener('DOMContentLoaded', function() {
  const dateInputs = document.querySelectorAll('html[dir="rtl"] .form-control[type="date"]');
  dateInputs.forEach(input => {
    const picker = input.querySelector('::-webkit-calendar-picker-indicator');
    if (picker) {
      picker.style.right = 'auto';
      picker.style.left = '0';
    }
  });
});

Answer №1

There is a well-known issue within the Chromium browser, which has been documented here: . Feel free to share your feedback on that platform.

To temporarily address this issue, you can apply CSS styles specifically for Chromium browsers to replicate the behavior found in Firefox:

<!DOCTYPE html>
<html dir="rtl">

<head>
  <meta charset="UTF-8>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
  <style>
    @supports (contain: paint) and (not (-moz-appearance: none)) {
      .form-control[type="date"] {
        padding-left: 1.5em; /* Adjust as needed */
        text-align: right;
      }
      .form-control[type="date"]::-webkit-calendar-picker-indicator {
        position: absolute;
        left: 0.2em; /* Adjust as needed */
        right: auto;
      }
    }
  </style>
</head>

<body>
  <input type="date" class="form-control" name="adjDate" id="adjDate" style="position: relative;">
</body>

</html>

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

Expanding Iframes in Joomla K2

Sorry if this question has been asked before, but I'm really struggling here... Here is the URL where the issue is happening: I am trying to embed an iframe from one of my client's websites onto my own personal website. Currently, I have the i ...

Overflow scrolling container with additional space to the right of an image

I am currently working on a project that involves a specific website. When examining the main battalion image, I noticed there is an excessive 300px of whitespace on the right side that I am struggling to remove. There is no hidden content or padding caus ...

Enhancing the background of a website with the power of CSS

I am looking to create a customized table without the balls/pots in it. The number of rows on the y-axis will vary depending on the number of names I have, and can be more or less. The values on the x-axis are determined by a parameter included in the URL ...

Choose a variety of photos for each individual input file

I am facing a scenario where I need to allow users to upload 3 images using input[type="file"]. Each input should only accept 1 image, but if a user selects more than 1 image in the first input, I want to distribute them among the subsequent inputs. For in ...

Displaying different page sections according to scrolling position

I am in the process of developing a single-page website and I am interested in having each section load only when the window scrolls to that specific section. While I am aware that images can be lazy-loaded, I am looking to lazy load the entire section. On ...

Using Google Script Code in Sheet to input a key and click on the submission button

Is there a way to enable using the Enter key in addition to clicking the submit button to input data and save it to a cell? I'm having trouble getting my current code to work. Any suggestions on how to modify it? <script> var itemBox = document ...

Problem with items overlapping in hoverable drop-down menu

I have been attempting to create a hoverable dropdown menu, but I am encountering an issue where the items of the dropdown are overlapping. Despite my efforts to adjust the CSS classes, I have not been successful in fixing this problem. Additionally, I ha ...

Differentiating between the components and contents of a webpage during the process of web scraping

import mechanize from bs4 import BeautifulSoup import urllib2 import cookielib cj = cookielib.CookieJar() br = mechanize.Browser() br.set_handle_robots(False) br.set_cookiejar(cj) br.open("*******") br.select_form(nr=0) br.form['ctl00$BodyConten ...

Sending a variable to the resize() function in jQuery

Currently, I am working with two specific divs in my project: "#sidebar-wrapper" and ".j1". The height of ".j1" is dynamic as it changes based on its content. My objective is to set this height value to the "#sidebar-wrapper" element. I have attempted to ...

"Exploring the World of Button Coloration

I'm struggling with customizing the colors of each of the 4 buttons that link to different tables using CSS. I want to assign a specific color to each button, like red for the first one and blue for the second. Your assistance in this matter would be ...

Exclude a particular row from a table when there is no identifier

My PHP code generates a basic table. <table border="1" id="control> <tbody> <tr>...</tr> <tr>...</tr> <tr>...</tr> //Row #3 <tr>...</tr> <tr>... ...

The controller is failing to effectively showcase the ng-show functionality

My webpage consists of three elements: a search bar, a search result area, and a form. The use case scenario involves showing the search bar and form div by default, while hiding the search result div. When I enter keywords into the search bar, client data ...

Exploring ways to retrieve complete HTML content from a Single Page Application using AJAX?

Seeking assistance in obtaining the complete HTML generated by a Single Page Application built on AngularJS. $.get('http://localhost:3388/' + d.response.path, function (d) { $('#templateContainer').html(d); ...

What is the best way to conceal an element and its descendants from being read by screen readers?

What is the best method to conceal an element and its children from both screen readers and keyboard access? Currently, I am focused on improving accessibility for the pages under my maintenance. However, there are certain advertising banners that cannot ...

Incorporate the <li> components into a search bar and ensure that the parent div element does not experience overflowing

Is it possible to have a user add entries to a search bar without them overflowing the parent div container with the class kitchen? I am looking for a way to limit the number of li elements that can be added to prevent overflow, and I am unsure of what lan ...

Is there a way to execute an onclick function prior to the Bootstrap 5 'hidden' event being triggered?

Our modal popup contains a button with an onclick event. In the previous version of Bootstrap, the onclick event would fire first when the modal was hidden, followed by the hidden.bs.modal event. However, in version 5.2, the hidden.bs.modal event now fire ...

How to use CSS to conceal asp:BoundField elements

Can someone help me figure out how to hide my asp:BoundField using CSS without losing access to the values? I've tried setting visible=false, but that prevents me from accessing the values. Then I attempted to hide it with CSS, but that doesn't w ...

What is the method for ensuring text remains within a square while it is being relocated?

Check out this jsfiddle where you can interact with a moving square: http://jsfiddle.net/helpme128/3kwwo53t/2/ <div ng-app="test" ng-controller="testCtrl"> <div id="container"> <div class="shape" ng-draggable='dragOptions& ...

Gradually shifting alignment of Bootstrap tooltips

I am encountering an issue with Bootstrap tooltips They seem to be progressively off-center Below is the code I am using for the icons {{#each guilds}} <div class="col-sm-1"> <a href="/dash/{{this.id}}"> <div class="gicon"> ...

What is the best way to delete the onclick event of an anchor element?

Struggling to remove the onclick attribute using jQuery? Here's my code: function getBusinesses(page){ if(page==0){ alert("you are already on First Page"); $("#previous a").removeAttr("onclick ...