Link: Unable to activate Link through ENTER key press
Describe the bug Per document, onClick should be "Fired when the Link is triggered either with a mouse/tap or by using the Enter key." However, onClick is not called by using Enter Key when it's focused.
Isolated Example https://codesandbox.io/s/sad-faraday-voiil?file=/src/App.js
To Reproduce Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/sad-faraday-voiil?file=/src/App.js
- Press
Tabkey to focus on the Link: 'Focus me and press Enter' - Press
Enterkey - The
onClickis not fired
Expected behavior
The onClick of the Link component should be fired by pressing Enter key
Screenshots If applicable, add screenshots to help explain your problem.
UI5 Web Components for React Information
@ui5/webcomponents version: 0.29.8 (@sf)
@ui5/webcomponents-react version: 0.129.8 (@sf)
Operating System: macOS Version 11.2.3
Browser: Chrome Version 89.0.4389.90
Additional context N/A
Hey @2bno1,
I'm not 100% sure whether the ui5-link should fire the onClick event after pressing the Enter key, so I'll forward this issue to the UI5 Web Components Repo for further investigation.
Hi guys,
As you can read in our docs, the ui5-link should fire click event either with a mouse/tap or by using the Enter key. Moreover, you can try to add click eventlistener to any of the links on the page and you can observe that the event is actually thrown.
Looks like this is somehow connected to the presence of the href attribute: https://codesandbox.io/s/nice-rhodes-508hc?file=/src/App.js
Hi @2bno1
you need to add the corresponding key event for this to work. Example
@Lukas742 Thanks, the example works. However, as ENTER key press is the standard keyboard activation key for links. Is there any plan to enhance this ui5-link component to handle ENTER key internally?
Hello @SAP/ui5-webcomponents-topic-b @tsanislavgatev
Could you take over this issue?
The ui5-link does not fire the "click" event on pressing the Enter key. The openui5 Link, for reference is firing its "press" event on Enter (even if "href" is not present), so I guess we have to fix this to make the web component behaves the same as the openui5 Link.
The author has provided an isolated example and steps to reproduce.