-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat(ui5-breadcrumbs): Initial implementation #3489
Conversation
packages/main/src/Link.js
Outdated
@@ -241,6 +254,9 @@ class Link extends UI5Element { | |||
} | |||
|
|||
get tabIndex() { | |||
if (this._tabIndex.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be undefined, -1 (valid and will be set) or 0 (valid and will be set) so we don't need to check length here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/main/src/themes/Label.css
Outdated
@@ -77,3 +77,9 @@ bdi { | |||
margin-right: .125rem; | |||
margin-left: 0; | |||
} | |||
|
|||
.ui5-label-root:focus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:host([focused]) .ui5-label-root since the focused attribute is updated on focusin/focusout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the label does not have a "focused" property... do you think we should add one, for consistency with other similar cases?
btw I checked that some components e.g. Carousel also do not define a "focused" property and use the :focus instead
packages/main/src/themes/Label.css
Outdated
.ui5-label-root:focus { | ||
outline-offset: -1px; | ||
outline: 1px dotted var(--sapContent_FocusColor); | ||
text-decoration: underline; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be set to ui5-label-text-wrapper otherwise it doesn't affect the text. Also I think we should skip this or to add shadow part to the the text wrapper and to style it from styles of breadcrumbs since it is ui5-breadcrumbs specific @ilhan007
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rule for "text-decoration" was added by me by mistake, I removed it as it is not needed at all
so I just tried to move this css to Breadcrumbs.css, but I do not seem to be allowed to target ui5-label-root from there
I need to target ui5-label-root as this is the element that has the tabIndex attribute (the inner ui5-label-text-wrapper is not focusable, sorry for overlooking the confusing "text-decoration" rule)
@@ -0,0 +1,29 @@ | |||
<ui5-responsive-popover | |||
no-arrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hide-arrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
86306b8
to
4c8772b
Compare
* @lends sap.ui.webcomponents.main.types.BreadcrumbsDesign.prototype | ||
* @public | ||
*/ | ||
const BreadcrumbsTypes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw here the 2 types are defined in accordance with the UX spec at:
https://ux.wdf.sap.corp/fiori-design-web/breadcrumb/#types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it works and looks great. Just some minor comments about the names of the aria properties, CSS selectors and JSDocs.
Also I don't see a playground sample. Is it intentionally posponed to be added later?
c2152b2
to
57243a0
Compare
The role presentation on the icon SVG is ignored in some cases: *The element is focusable, e.g. it is natively focusable like an HTML link or input, or it has a tabindex attribute. *The element has any of the twenty-one global ARIA states and properties, e.g., aria-label. With this change we introduce ariaHidden property on ui5-icon to be able to completly hide it from accessibility tree mapping. Also, change the default value of effectiveAccessibleName to undefined as a value of "" will still set the aria-label attribute and the presentation role will be ignroed. Fixes SAP#3433
The role presentation on the icon SVG is ignored in some cases: *The element is focusable, e.g. it is natively focusable like an HTML link or input, or it has a tabindex attribute. *The element has any of the twenty-one global ARIA states and properties, e.g., aria-label. With this change we introduce ariaHidden property on ui5-icon to be able to completly hide it from accessibility tree mapping. Also, change the default value of effectiveAccessibleName to undefined as a value of "" will still set the aria-label attribute and the presentation role will be ignroed. Fixes SAP#3433
packages/main/src/Link.js
Outdated
* @private | ||
* @since 1.0.0-rc.15 | ||
*/ | ||
role: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text "More button menu" is read out twice upon focusing the ui5-link
with overflowed items.
This is because of this attribute being named role
. The screen reader reads the role and the label twice. Once from the custom element and once from the internal shadow dom element. If we rename this property to accRole
the announcment is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe accessibleRole, to be consistent with the List and Panel components, where this is how it is named.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to "accessibleRole"
|
||
/** | ||
* Determines the visual style of the separator between the breadcrumb items. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List the options in the description in this way:
* <br><br>
* Available options are:
* <ul>
* <li><code>TopStart</code></li>
* <li><code>BottomCenter</code></li>
* <li><code>BottomEnd</code></li>
* </ul>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/main/src/Breadcrumbs.js
Outdated
* @class | ||
* | ||
* <h3 class="comment-api-title">Overview</h3> | ||
* Enables users to navigate between items by providing a list of links to previous steps in the user's navigation path. The last three steps can be accessed as links directly, while the remaining links prior to them are available in a drop-down menu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a KM, perhaps you can involve him/her to review or add more information if necessary.
packages/main/src/Breadcrumbs.js
Outdated
* @param {HTMLElement} link The clicked link. | ||
* @public | ||
*/ | ||
"link-click": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item-click
might be also a candidate, as the child component is BreadcrumbsItem and the Breadcrumbs slot is referred as "items" (although default), maybe you can consider that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I pondered earlier about the event name!
The name "item-click" is consistent with the slot name, but I named it "link-click" because currently no event is fired if the clicked item is the one that stands for the "current-location" label. For now I see two options:
- fire the event even when the "current-location" label is pressed - but if we want to keep the label as non-interactive, then I discard this option
OR - rename the event from "link-click" to "item-click" nevertheless, for consistence with the slot name
What do you think?
Thnx!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually refactored to "item-click" that fires on click on any item, as it makes most sense
*/ | ||
const metadata = { | ||
tag: "ui5-breadcrumbs-item", | ||
managedSlots: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need "managedSlots: true," here, probably copied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added "managedSlots: true" to be able to react (recalculate the number of overflowing links) whenever the text of the link changes.
Do you have a better idea in mind?
Btw earlier I used a ResizeHandler on a content wrapper, but seemed like the less efficient solution, especially to monitor changes in the size of links that are currently in the overflow.
Hi @gmkv, I agree to not set focus on the label itself but on a wrapper element. Done. |
all requested changes of @xtatica are integrated |
* <h3 class="comment-api-title">Overview</h3> | ||
* | ||
* The <code>ui5-breadcrumbs-item</code> component defines the content of an item in <code>ui5-breadcumbs</code>. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a <h3>Keyboard Handling</h3>
section somewhere here with supported key shortcuts . Similar to other components, see ui5-select
for example :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me, @SAP/ui5-webcomponents-topic-p it's up to you to finish the review.
outdated - Documentation Review addressed
Thanks to all involved for the code review of this big change...! Waiting for @nnaydenow for final vote. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kineticjs looks good to me. @ilhan007 could you please confirm which version we should use in JSDoc? I'm not sure if the rc-15 is already released and in which version we will release that component.
* @type String | ||
* @defaultvalue undefined | ||
* @private | ||
* @since 1.0.0-rc.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this version. @ilhan007 could you check please?
Let's keep it RC.16, we can update that any time if needed. We are about to release RC.15 including IllustratedMessage and BarcodeScannerDialog (thanks for these two as well) and we plan to leave the Breadcrumbs for the next stable version. |
Fixes #3166