-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: determine accname for elements with slots (#442)
- Loading branch information
Showing
4 changed files
with
111 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
"dom-accessibility-api": patch | ||
--- | ||
|
||
Correctly determine accessible name when element contains a slot. | ||
|
||
Previously, computing the accessible name would only examine child nodes. However, content placed in a slot is is an assigned node, not a child node. | ||
|
||
If you have a custom element `custom-button` with a slot: | ||
|
||
```html | ||
<button><slot></slot></button> | ||
|
||
<!-- accname of inner <button> is 'Custom name' (previously '') --> | ||
<custom-button>Custom name</custom-button> | ||
``` | ||
|
||
If you have a custom element `custom-button-default` with default content in the slot: | ||
|
||
```html | ||
<button><slot>Default name</slot></button> | ||
|
||
<!-- accname of inner <button> is 'Custom name' (previously 'Default name') --> | ||
<custom-button-default>Custom name</custom-button-default> | ||
|
||
<!-- accname of inner <button> is 'Default name' (previously 'Default name') --> | ||
<custom-button-default></custom-button-default> | ||
``` | ||
|
||
This is not currently defined in the accname spec but reflects current browser behavior. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters