focus dialog on open; fixes #1302

This commit is contained in:
Cory LaViska
2025-10-14 14:06:13 -04:00
parent 3c0924fac2
commit 0b39ca6ca2
3 changed files with 5 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
- Fixed focus outline styles in `<wa-scroller>`, `<wa-dialog>`, and `<wa-drawer>` [issue:1484]
- Fixed a bug that caused icon button labels to not render in frameworks [issue:1542]
- Fixed a bug in `<wa-details>` that caused the `name` property not to reflect [pr:1538]
- Fixed a bug in `<wa-dialog>` and `<wa-drawer>` that prevented focus from being set on the dialog/drawer when opened [issue:1302]
## 3.0.0-beta.6

View File

@@ -197,6 +197,8 @@ export default class WaDialog extends WebAwesomeElement {
const elementToFocus = this.querySelector<HTMLButtonElement>('[autofocus]');
if (elementToFocus && typeof elementToFocus.focus === 'function') {
elementToFocus.focus();
} else {
this.dialog.focus();
}
});

View File

@@ -210,6 +210,8 @@ export default class WaDrawer extends WebAwesomeElement {
const elementToFocus = this.querySelector<HTMLButtonElement>('[autofocus]');
if (elementToFocus && typeof elementToFocus.focus === 'function') {
elementToFocus.focus();
} else {
this.drawer.focus();
}
});