Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): more customization of aria attributes for multi-input #12438

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libs/core/src/lib/multi-input/multi-input.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
[isExpanded]="open && !mobile && viewModel.displayedOptions.length > 0"
[isControl]="true"
[glyph]="showAddonButton ? glyph : ''"
[addonButtonAriaHidden]="!!title"
[addonButtonAriaHidden]="addonButtonAriaHidden"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

We have a common issue throughout the application where we use aria-hidden on focusable elements or elements with focusable children, which isn't allowed. In this case, the button is focusable and causes the error shown in the screenshot. I fixed a similar issue in my PR: #12445.
image

(addOnButtonClicked)="_addOnButtonClicked($event)"
[iconTitle]="addonIconTitle"
[glyphAriaLabel]="addOnButtonAriaLabel"
>
<span [attr.id]="tokenHiddenId" aria-hidden="true" class="fd-multi-input__invisible-text">{{
'coreMultiInput.tokensCountText' | fdTranslate : { length: selected.length }
Expand Down Expand Up @@ -100,6 +101,7 @@
[attr.id]="inputId"
(focus)="tokenizer._showAllTokens()"
(blur)="tokenizer._hideTokens()"
[attr.title]="title"
/>
</fd-tokenizer>
</fd-input-group>
Expand Down
10 changes: 9 additions & 1 deletion libs/core/src/lib/multi-input/multi-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,18 @@ export class MultiInputComponent<ItemType = any, ValueType = any>
@Input()
open = false;

/** Whether or not to display the addon button. */
/** Whether to display the addon button. */
@Input()
displayAddonButton = true;

/** Whether to hide the addon button from the screenreader. */
@Input()
addonButtonAriaHidden = false;

/** Aria-label for the addon button. */
@Input()
addOnButtonAriaLabel: Nullable<string>;

/** @hidden */
private _tokenCountHiddenLabel = `fd-multi-input-token-count-id-${uniqueHiddenLabel++}`;

Expand Down
Loading