From 943431159aaf66a7e64ecf6b050be0663256ec66 Mon Sep 17 00:00:00 2001 From: Christopher Morgan Date: Fri, 10 Jan 2025 16:09:39 -0500 Subject: [PATCH] fix(Select) preserve native select tabIndex value and assign to input element materializecss#510 --- src/select.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/select.ts b/src/select.ts index 65b7e5f96f..2a681624ff 100644 --- a/src/select.ts +++ b/src/select.ts @@ -44,6 +44,7 @@ export class FormSelect extends Component { wrapper: HTMLDivElement; selectOptions: (HTMLOptionElement | HTMLOptGroupElement)[]; private _values: ValueStruct[]; + nativeTabIndex: number; constructor(el: HTMLSelectElement, options: FormSelectOptions) { super(el, options, FormSelect); @@ -56,6 +57,7 @@ export class FormSelect extends Component { }; this.isMultiple = this.el.multiple; + this.nativeTabIndex = (this.el.tabIndex ?? -1); this.el.tabIndex = -1; this._values = []; this._setupDropdown(); @@ -258,6 +260,7 @@ export class FormSelect extends Component { this.input.ariaReadOnly = 'true'; this.input.ariaRequired = this.el.hasAttribute('required').toString(); //setAttribute("aria-required", this.el.hasAttribute("required")); if (this.el.disabled) this.input.disabled = true; // 'true'); + this.input.setAttribute('tabindex', this.nativeTabIndex.toString()); const attrs = this.el.attributes; for (let i = 0; i < attrs.length; ++i) {