Skip to content
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

fix(ui5-shellbar): enable items keyboard handling #1473

Merged
merged 9 commits into from
Apr 14, 2020
Merged

Conversation

ilhan007
Copy link
Member

@ilhan007 ilhan007 commented Apr 13, 2020

Fixes

  • Enable moving between all focusable items in she ShellBar with TAB and SHIFT + TAB
  • all actions can be now triggered with SPACE or ENTER

Background
All ui5-icon elements now become ui5-button, the ui5-button has tabindex=0 and also can be triggered with SPACE and ENTER. To ensure the correct tab order, the layout of the items is changed in such way that their DOM order is the same as their display order.

ezgif com-video-to-gif

Fixes: #860

@ilhan007 ilhan007 requested a review from MapTo0 April 13, 2020 16:35
@ilhan007 ilhan007 changed the title fix(ui5-shellbar): enable items navigation fix(ui5-shellbar): enable items keyboard handling Apr 13, 2020
@ilhan007 ilhan007 changed the title fix(ui5-shellbar): enable items keyboard handling WIP(ui5-shellbar): enable items keyboard handling Apr 14, 2020
@ilhan007 ilhan007 changed the title WIP(ui5-shellbar): enable items keyboard handling fix(ui5-shellbar): enable items keyboard handling Apr 14, 2020
Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the simplification! Most of the tricky code is gone.
A couple of things I found:

  • On IE the focus looks bad, a bit off and with the wrong color. However, on IE pressing space/enter activates the buttons so you really know you pressed something.
  • On Chrome, buttons are not activated by pressing space/enter, even though they work. When you click with the mouse, they activate properly
  • On all browsers: pressing the menu items button does not focus the first menu item when opening the popup. Also, when closing the popup, the focus does not go back to the button so that you can continue tabbing. The other menu (clicking the profile picuter) however works fine.
  • When on any of the menus (menu items dropdown, or profile dropdown) pressing Tab does nothing. I assume it has to close the menu and go to the next button on the shellbar, but I might be wrong.

@@ -35,6 +35,11 @@
font-weight: bold;
}

.ui5-shellbar-menu-button,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IE fails when selectors such as :host, ::slotted are mixed with other selectors.
Same with the IE CSS processing script.
On IE the button focus looks broken (black) maybe this is part of the reason?

@ilhan007
Copy link
Member Author

ilhan007 commented Apr 14, 2020

I really like the simplification! Most of the tricky code is gone.
A couple of things I found:

  • On IE the focus looks bad, a bit off and with the wrong color. However, on IE pressing space/enter activates the buttons so you really know you pressed something.
  • On Chrome, buttons are not activated by pressing space/enter, even though they work. When you click with the mouse, they activate properly
  • On all browsers: pressing the menu items button does not focus the first menu item when opening the popup. Also, when closing the popup, the focus does not go back to the button so that you can continue tabbing. The other menu (clicking the profile picuter) however works fine.
  • When on any of the menus (menu items dropdown, or profile dropdown) pressing Tab does nothing. I assume it has to close the menu and go to the next button on the shellbar, but I might be wrong.

Prior to my last commit it was Work in progress, now with the last commit:

(1) The focus on IE should look fine

(2) The buttons on Chrome and IE are activated with SPACE and ENTER. If a button opens a popover the ENTER seems not to change the background, but this is general issue (if it is issue) not related to this change, see Popover.html test page.

(3) I will check why the first menu works differently, but it is the same in the master, not broken with this change

(4) Again, but this is in general issue, see the Popover.html with a list inside its content, pressing TAB does not make anything, because someone implemented the focus to always remain in the popover. However, you can use ESC to close the popover and the focus will be brought back to the opener.

Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<button tabindex="0" class="{{classes.button}}" @click="{{_header.press}}">
This button, when inactive, still gets the focus and it looks like the focus is lost. Probably tabindex should be "-1" whenever the button is non-interactive.

On IE, for me the focus is still broken for the small buttons on the right:
image

This is the focus on master:
image

I know this is not due to your change, and it was broken before, but all the shellbar buttons do not get active state on space/enter, only on clicking with the mouse. I think it would be best to address this problem with this change (but I'm fine with doing this later, if you prefer so).
I look at: https://ui5.sap.com/#/entity/sap.f.ShellBar/sample/sap.f.sample.ShellBar
as a reference. There, the shellbar buttons have active state as I would expect.

The co-pilot button's focus is blue, should be white, as in the link above.

@@ -34,42 +33,18 @@

<div class="ui5-shellbar-overflow-container ui5-shellbar-overflow-container-middle">
{{#if showCoPilot}}
{{> coPilot}}
<div class="ui5-shellbar-copilot-wrapper"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this is focused, the focus is blue and only seen on the sides, not on top/bottom. Is this expected?

Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, some of my previous reports were wrong due to hang-up dev server.
All is great now

@ilhan007 ilhan007 merged commit 185851a into master Apr 14, 2020
@ilhan007 ilhan007 deleted the fix-shellbar-kh branch April 14, 2020 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui5-shellbar keyboard navigation broken
3 participants