Skip to content

Commit ca3086c

Browse files
fix(select): variant attr, tests (#2677)
* fix(select): variant attr, tests * fix(select): add accessibleToggleLabel * fix(select): make accessibleToggleLabel not default to '' * fix(select): badges and typeahead * fix(core): add willChange to toggleController * docs(select): update typehead demos with variant attr * docs(select): remove extra multi attr * docs(select): correct checkbox demo to use variant attr * fix(select): update badge on keyboard select * docs(select): remove duplicative demo, rename chip to checkbox hide badge * fix(select): rename selectedList consider removing this * test(select): more keyboard tests * fix(select): factor out always-expanded and selectedList * fix(select): create toggleController * test(select): tiny refactor * fix(select): option value defaults to textContent like HTMLOptionElement.value * fix(select): remove match-anywhere and case-sensitive, add customFilter * test(select): add cases * perf(core): prevent memory leak in listboxcontroller * fix(select): tabbing out of listbox * fix(select): rename attr * docs(select): custom filter demo * fix(select): non-chrome toggle * fix(select): toggle focus listbox * docs(select): update some demos * docs(select): more docs * feat(select): label attr for option group * fix(core): workaround for delegatesFocus cross-browser issue * docs(select): custom filtering example * fix(select): remove create option feature, implement FACE pfv5 removes the complicated logic for creating options, making it a "pattern" instead. We opt not to implement that feature here * style: small refactors * refactor(select)!: remove typeahead and rename listbox controller * fix(select): tests green * docs(select): align with pf v4 docs * fix(select): change hide-badge to checkbox-selection-badge-hidden * fix: tabs controller internal apis a later pr will fix this for real * fix(chip): hide empty group * fix(select): change default-text to placeholder and make it an attr/slot pair * test(select): update test cases The changes to placeholder behaviour in 563fa52 required updating test cases, since now the placeholder is treated for all intents and purposes as a disabled option --------- Co-authored-by: Steven Spriggs <[email protected]>
1 parent 20cb613 commit ca3086c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1838
-2591
lines changed

core/pfe-core/controllers/internals-controller.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ export class InternalsController implements ReactiveController, ARIAMixin {
6969
// using a public static constructor method is much easier to manage,
7070
// due to the quirks of our typescript config
7171
const instance: InternalsController =
72-
InternalsController.instances.get(host) ?? new InternalsController(host, options);
73-
instance.initializeAriaMixinPropertyValues(options);
72+
InternalsController.instances.get(host) ??
73+
new InternalsController(host, options);
74+
instance.initializeOptions(options);
7475
constructingAllowed = false;
7576
return instance;
7677
}
@@ -175,7 +176,7 @@ export class InternalsController implements ReactiveController, ARIAMixin {
175176
throw new Error('InternalsController must be instantiated with an HTMLElement or a `getHTMLElement` function');
176177
}
177178
this.attach();
178-
this.initializeAriaMixinPropertyValues(options);
179+
this.initializeOptions(options);
179180
InternalsController.instances.set(host, this);
180181
this.#polyfillDisabledPseudo();
181182
}
@@ -210,8 +211,11 @@ export class InternalsController implements ReactiveController, ARIAMixin {
210211
return this.internals;
211212
}
212213

213-
private initializeAriaMixinPropertyValues(options?: Partial<ARIAMixin>) {
214-
for (const [key, val] of Object.entries(options ?? {})) {
214+
private initializeOptions(options?: Partial<ARIAMixin>) {
215+
this.options ??= options ?? {};
216+
const { getHTMLElement, ...aria } = this.options;
217+
this.options.getHTMLElement ??= getHTMLElement;
218+
for (const [key, val] of Object.entries(aria)) {
215219
if (isARIAMixinProp(key)) {
216220
this[key] = val;
217221
}

0 commit comments

Comments
 (0)