Fixed #5055 - Calendar: When use with Datatable filter, the calendar would show at the bottom of the page.

This commit is contained in:
mertsincan 2024-01-21 11:56:17 +00:00
parent ae81a90b73
commit e3d9f41926
3 changed files with 11 additions and 4 deletions

View file

@ -8,7 +8,7 @@ const FocusTrap = BaseFocusTrap.extend('focustrap', {
if (!disabled) {
this.createHiddenFocusableElements(el, binding);
this.bind(el, binding);
this.autoFocus(el, binding);
this.autoElementFocus(el, binding);
}
el.setAttribute('data-pd-focustrap', true);
@ -64,7 +64,10 @@ const FocusTrap = BaseFocusTrap.extend('focustrap', {
el.$_pfocustrap_focusinlistener && el.removeEventListener('focusin', el.$_pfocustrap_focusinlistener) && (el.$_pfocustrap_focusinlistener = null);
el.$_pfocustrap_focusoutlistener && el.removeEventListener('focusout', el.$_pfocustrap_focusoutlistener) && (el.$_pfocustrap_focusoutlistener = null);
},
autoFocus(el, binding) {
autoFocus(options) {
this.autoElementFocus(this.$el, { value: { ...options, autoFocus: true } });
},
autoElementFocus(el, binding) {
const { autoFocusSelector = '', firstFocusableSelector = '', autoFocus = false } = binding.value || {};
let focusableElement = DomHandler.getFirstFocusableElement(el, `[autofocus]${this.getComputedSelector(autoFocusSelector)}`);