ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

ui5-popover is not accessible for keyboard-only [accessibility]

Open sleric1024 opened this issue 6 years ago • 6 comments

Hi UI5 WebComponents team,

I am Eric from Successfactors, currently we are using ui5-popover control while the accessibility team suggest that the popover need to be accessible through keyboard-only, which means the popover dialog can be focused with keyboard and the currently version doesn't support this.

Issue: ui5-popover is not accessible for keyboard-only

Expected: ui5-popover is accessible through keyboard-only , screen reader users and provide tabindex for the focus.

sleric1024 avatar Jun 15 '20 06:06 sleric1024

Hello @sleric1024

Unfortunately I wasn't able to reproduce the issue on my side. As you can see in the attached video, everything is working properly within the ui5-popover. All the interactions in this video were made via the keyboard as you can see the mouse is not moving.

ezgif com-video-to-gif (3)

Moreover, if you inspect the DOM you can find the necessary accessibility attributes present: Screenshot 2020-06-15 at 10 37 47

Which version of UI5 Web Components are you using?

Best regards, Filip

fifoosid avatar Jun 15 '20 07:06 fifoosid

Hi Fillip, Thanks for you reply. The functionality works good. While I wonder wether it is possible to access the whole dialog with the accessibility attribute tabindex ? image

Best Regards, Eric

sleric1024 avatar Jun 15 '20 09:06 sleric1024

Hi @sleric1024

By default all focusable elements inside the popover/dialog must be reachable via the keyboard. As the popover/dialog are not focusable elements themselves(they cannot execute actions like a button for example), they shouldn't be focusable, which means that adding a tabindex is not recommended.

If you insist having a tabindex on the content of the popover/dialog you can set it on the element that you provide as default slot. For example:

<ui5-popover header-text="My Heading">
	<div tabindex="0">
		<ui5-list>
			<ui5-li>Hello</ui5-li>
			<ui5-li>World</ui5-li>
			<ui5-li>Again</ui5-li>
		</ui5-list>

		<ui5-button>Cool Button</ui5-button>

		<ui5-select>
			<ui5-option>Hello</ui5-option>
			<ui5-option>World</ui5-option>
		</ui5-select>
	</div>
</ui5-popover>

fifoosid avatar Jun 15 '20 10:06 fifoosid

Hi @fifoosid , thank you for your kind and helpful suggestion. :)

sleric1024 avatar Jun 15 '20 14:06 sleric1024

Hi @fifoosid and @sleric1024 Thanks for your kindly response. But i still need your help, i know the issue can not reproduce with your provided solution. But from the performance optimization perspective, i hope the popover content only be initialized after the popover opened; Here is my use case, let's image there is a large list in the popover, it will cause large performance consumption to render the list even thought the popover never be opened.

So how to deal with this case to lazy load the large list and only render it after popover opened to reduce the performance consumption.

Regards, Sherry

SherrySherry123 avatar Jun 18 '20 10:06 SherrySherry123

Hi @SherrySherry123

I think that your comment is with regards to the following issue: #1750

If so, my advice is to sync the lazy loading & the opening of the responsive popover. What I mean is to call responsivePopover.open() later in time(this time would be used by React to insert the content of the responsive popover in the DOM).

I would personally go for ~17ms timeout because requestAnimationFrame is called on every 1000/60 (explained below), or around 16.7 milliseconds. The reason for that is simple: the requestAnimationFrame that you would have waited to be executed, would insert the content in the DOM. In other words, you can wait for 17ms before opening the popover:

setTimeout(() => {
    document.querySelector("ui5-responsive-popover").open();
}, 17)

Explanation: The numbers are not random: As you can read here, this value simulates how often the real requestAnimationFrame() will typically be called by the browser.

fifoosid avatar Jun 18 '20 12:06 fifoosid