-
-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Group accessibility-related props of DndContext (#746)
- Loading branch information
Showing
9 changed files
with
80 additions
and
30 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,34 @@ | ||
--- | ||
'@dnd-kit/core': major | ||
--- | ||
|
||
#### Regrouping accessibility-related props | ||
|
||
Accessibility-related props have been regrouped under the `accessibility` prop of `<DndContext>`: | ||
|
||
```diff | ||
<DndContext | ||
- announcements={customAnnouncements} | ||
- screenReaderInstructions={customScreenReaderInstructions} | ||
+ accessibility={{ | ||
+ announcements: customAnnouncements, | ||
+ screenReaderInstructions: customScreenReaderInstructions, | ||
+ }} | ||
``` | ||
|
||
This is a breaking change that will allow easier addition of new accessibility-related features without overloading the props namespace of `<DndContext>`. | ||
|
||
#### Accessibility-related DOM nodes are no longer portaled by default | ||
|
||
The DOM nodes for the screen reader instructions and announcements are no longer portaled into the `document.body` element by default. | ||
|
||
This change is motivated by the fact that screen readers do not always announce ARIA live regions that are rendered on the `document.body`. Common examples of this include when rendering a `<DndContext>` within a `<dialog>` element or an element that has `role="dialog"`, only ARIA live regions rendered within the dialog will be announced. | ||
|
||
Consumers can now opt to render announcements in the portal container of their choice using the `container` property of the `accessibility` prop: | ||
|
||
```diff | ||
<DndContext | ||
+ accessibility={{ | ||
+ container: document.body, | ||
+ }} | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export {Accessibility} from './Accessibility'; | ||
export {defaultAnnouncements, screenReaderInstructions} from './defaults'; | ||
export { | ||
defaultAnnouncements, | ||
defaultScreenReaderInstructions, | ||
} from './defaults'; | ||
export type {Announcements, ScreenReaderInstructions} from './types'; |
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
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