Skip to content

Link: Unable to activate Link through ENTER key press #3007

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

Closed
2bno1 opened this issue Mar 24, 2021 · 6 comments · Fixed by #3374
Closed

Link: Unable to activate Link through ENTER key press #3007

2bno1 opened this issue Mar 24, 2021 · 6 comments · Fixed by #3374
Assignees
Labels
bug This issue is a bug in the code Medium Prio SAP SF

Comments

@2bno1
Copy link

2bno1 commented Mar 24, 2021

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:

  1. Go to https://codesandbox.io/s/sad-faraday-voiil?file=/src/App.js
  2. Press Tab key to focus on the Link: 'Focus me and press Enter'
  3. Press Enter key
  4. The onClick is 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

@Lukas742
Copy link
Collaborator

Hi @2bno1

you need to add the corresponding key event for this to work. Example

@MarcusNotheis
Copy link
Collaborator

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.

@MarcusNotheis MarcusNotheis transferred this issue from SAP/ui5-webcomponents-react Mar 24, 2021
@fifoosid fifoosid self-assigned this Mar 24, 2021
@fifoosid
Copy link
Contributor

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.

@MarcusNotheis
Copy link
Collaborator

Looks like this is somehow connected to the presence of the href attribute: https://codesandbox.io/s/nice-rhodes-508hc?file=/src/App.js

@2bno1
Copy link
Author

2bno1 commented Mar 25, 2021

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?

@ilhan007
Copy link
Member

ilhan007 commented Jun 1, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code Medium Prio SAP SF
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

6 participants