-
Notifications
You must be signed in to change notification settings - Fork 275
feat(ui5-shellbar): implement accessibility spec #1553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d06724e
feat(ui5-shellbar): implement accessibility spec
nnaydenow 6ecacc7
- extracted static text into resource bundle
nnaydenow 07a9621
fixed review comments
nnaydenow a72e3d6
fixed review comments
nnaydenow 849a5a9
fixed typos in messagebundle
nnaydenow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -144,6 +144,14 @@ const metadata = { | |
type: String, | ||
multiple: true, | ||
}, | ||
_menuPopoverExpanded: { | ||
type: Boolean, | ||
noAttribute: true, | ||
}, | ||
_overflowPopoverExpanded: { | ||
type: Boolean, | ||
noAttribute: true, | ||
}, | ||
}, | ||
managedSlots: true, | ||
slots: /** @lends sap.ui.webcomponents.fiori.ShellBar.prototype */ { | ||
|
@@ -389,7 +397,7 @@ class ShellBar extends UI5Element { | |
press: async () => { | ||
this._updateClonedMenuItems(); | ||
|
||
if (this.menuItems.length) { | ||
if (this.hasMenuItems) { | ||
this.updateStaticAreaItemContentDensity(); | ||
const menuPopover = await this._getMenuPopover(); | ||
menuPopover.openBy(this.shadowRoot.querySelector(".ui5-shellbar-menu-button")); | ||
|
@@ -414,12 +422,45 @@ class ShellBar extends UI5Element { | |
}, true); | ||
} | ||
|
||
_logoPress(event) { | ||
_logoPress() { | ||
this.fireEvent("logoClick", { | ||
targetRef: this.shadowRoot.querySelector(".ui5-shellbar-logo"), | ||
}); | ||
} | ||
|
||
_menuPopoverBeforeOpen() { | ||
this._menuPopoverExpanded = true; | ||
} | ||
|
||
_menuPopoverAfterClose() { | ||
this._menuPopoverExpanded = false; | ||
} | ||
|
||
_overflowPopoverBeforeOpen() { | ||
this._overflowPopoverExpanded = true; | ||
} | ||
|
||
_overflowPopoverAfterClose() { | ||
this._overflowPopoverExpanded = false; | ||
} | ||
|
||
_logoKeyup(event) { | ||
if (isSpace(event)) { | ||
this._logoPress(); | ||
} | ||
} | ||
|
||
_logoKeydown(event) { | ||
if (isSpace(event)) { | ||
event.preventDefault(); | ||
return; | ||
} | ||
|
||
if (isEnter(event)) { | ||
this._logoPress(); | ||
} | ||
} | ||
|
||
_fireCoPilotClick() { | ||
this.fireEvent("coPilotClick", { | ||
targetRef: this.shadowRoot.querySelector(".ui5-shellbar-coPilot"), | ||
|
@@ -792,7 +833,7 @@ class ShellBar extends UI5Element { | |
"ui5-shellbar-with-searchfield": this.searchField.length, | ||
}, | ||
button: { | ||
"ui5-shellbar-menu-button--interactive": !!this.menuItems.length, | ||
"ui5-shellbar-menu-button--interactive": this.hasMenuItems, | ||
"ui5-shellbar-menu-button": true, | ||
}, | ||
items: { | ||
|
@@ -840,11 +881,19 @@ class ShellBar extends UI5Element { | |
} | ||
|
||
get interactiveLogo() { | ||
return this.breakpointSize === "S"; | ||
return this.breakpointSize === "S" && this.hasMenuItems; | ||
} | ||
|
||
get hasNonInteractiveLogo() { | ||
return this.logo && !this.interactiveLogo; | ||
} | ||
|
||
get hasInteractiveLogo() { | ||
return this.logo && this.interactiveLogo; | ||
} | ||
|
||
get showArrowDown() { | ||
return this.primaryTitle || (this.logo && this.interactiveLogo); | ||
return this.primaryTitle || this.hasInteractvieLogo; | ||
} | ||
|
||
get popoverHorizontalAlign() { | ||
|
@@ -863,8 +912,43 @@ class ShellBar extends UI5Element { | |
return !!this.profile.length; | ||
} | ||
|
||
get hasMenuItems() { | ||
return this.menuItems.length > 0; | ||
} | ||
|
||
get menuBtnHasPopup() { | ||
return this.hasMenuItems ? true : undefined; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "true" seems more appropriate, but if it works this way it's ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be cast to string in when it is used in hbs |
||
} | ||
|
||
get menuBtnTabindex() { | ||
return this.menuItems.length > 0 ? "0" : "-1"; | ||
return this.hasMenuItems ? "0" : "-1"; | ||
} | ||
|
||
get menuPopoverExpanded() { | ||
return this.hasMenuItems ? this._menuPopoverExpanded : undefined; | ||
} | ||
|
||
get accInfo() { | ||
return { | ||
notifications: { | ||
"title": `${this.notificationCount} Notications`, | ||
}, | ||
profile: { | ||
"title": "Profile", | ||
}, | ||
products: { | ||
"title": "Products", | ||
}, | ||
search: { | ||
"ariaExpanded": this.showSearchField, | ||
"title": "Search", | ||
}, | ||
overflow: { | ||
"title": "More", | ||
"ariaHaspopup": true, | ||
"ariaExpanded": this._overflowPopoverExpanded, | ||
}, | ||
}; | ||
} | ||
|
||
static async onDefine() { | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.