-
Notifications
You must be signed in to change notification settings - Fork 11
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(alert): not announced correctly in screen reader (VIV-1970) #2235
Changes from all commits
98b5da4
d86ef90
21527d7
5068bf2
3890847
3ee172f
9a778e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,13 +134,11 @@ export class Alert extends VividElement { | |
this.#setupTimeout(); | ||
if (newValue) { | ||
this.style.display = 'contents'; | ||
const alertText = this.shadowRoot!.querySelector( | ||
'.alert-text' | ||
const closeBtn = this.shadowRoot!.querySelector( | ||
'.dismiss-button' | ||
) as HTMLElement; | ||
if (this.removable && alertText) { | ||
alertText.setAttribute('tabindex', '0'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the tabindex is not needed anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because focus is set to the close button. |
||
alertText.focus(); | ||
alertText.removeAttribute('tabindex'); | ||
if (this.removable && closeBtn) { | ||
closeBtn.focus(); | ||
} | ||
} else { | ||
this.style.display = 'none'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for
alertdialog
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. It's not an alertdialog (like a confirmation dialog), it is a closable alert.
I checked how other design system's tackled it and this seemed to be the most common.
Also, it works as expected.