mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
focus dialog on open; fixes #1302
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user