mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(menu): main content is not scrollable while swiping (#26976)
resolves #21193
This commit is contained in:
@@ -578,6 +578,25 @@ export class Menu implements ComponentInterface, MenuI {
|
||||
if (this.backdropEl) {
|
||||
this.backdropEl.classList.add(SHOW_BACKDROP);
|
||||
}
|
||||
|
||||
// add css class and hide content behind menu from screen readers
|
||||
if (this.contentEl) {
|
||||
this.contentEl.classList.add(MENU_CONTENT_OPEN);
|
||||
|
||||
/**
|
||||
* When the menu is open and overlaying the main
|
||||
* content, the main content should not be announced
|
||||
* by the screenreader as the menu is the main
|
||||
* focus. This is useful with screenreaders that have
|
||||
* "read from top" gestures that read the entire
|
||||
* page from top to bottom when activated.
|
||||
* This should be done before the animation starts
|
||||
* so that users cannot accidentally scroll
|
||||
* the content while dragging a menu open.
|
||||
*/
|
||||
this.contentEl.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
|
||||
this.blocker.block();
|
||||
this.isAnimating = true;
|
||||
if (shouldOpen) {
|
||||
@@ -601,21 +620,6 @@ export class Menu implements ComponentInterface, MenuI {
|
||||
}
|
||||
|
||||
if (isOpen) {
|
||||
// add css class and hide content behind menu from screen readers
|
||||
if (this.contentEl) {
|
||||
this.contentEl.classList.add(MENU_CONTENT_OPEN);
|
||||
|
||||
/**
|
||||
* When the menu is open and overlaying the main
|
||||
* content, the main content should not be announced
|
||||
* by the screenreader as the menu is the main
|
||||
* focus. This is useful with screenreaders that have
|
||||
* "read from top" gestures that read the entire
|
||||
* page from top to bottom when activated.
|
||||
*/
|
||||
this.contentEl.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
|
||||
// emit open event
|
||||
this.ionDidOpen.emit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user