Topic: DatePicker click/focus issue

miroslav.mirkovic free asked 2 years ago


Expected behavior
Datepicker should be opened on 'focus' but also on 'click'

Actual behavior
If I have onFocus and onClick listeners for openning datePicker it will work on FOCUS but it will not work on CLICK. I need this in order to open automatically DatePicker on TAB (keyboard or mobile keyboard). Is there a different way to achieve this? Basically, it needs to work on click and also on tab.

Resources (screenshots, code snippets etc.)
const datepickerParent = document.querySelector('.datepicker-parent');
const datePicker = new mdb.Datepicker(datepickerParent, {
max: maxParentDate,
startDate: startParentDate,
format: 'dd. mmmm yyyy.',
});

datePicker.open();


Kamila Pieńkowska staff answered 2 years ago


Opening datepicker on click is the default behavior. When you focus datepicker icon with the Tab and press Enter it also will open. Do you really need to add additional listeners?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 5.0.0
  • Device: on every
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No