fix(ui5-shellbar-branding): space key now triggers click event#13686
Open
PetyaMarkovaBogdanova wants to merge 8 commits into
Open
fix(ui5-shellbar-branding): space key now triggers click event#13686PetyaMarkovaBogdanova wants to merge 8 commits into
PetyaMarkovaBogdanova wants to merge 8 commits into
Conversation
|
🚀 Deployed on https://pr-13686--ui5-webcomponents-preview.netlify.app |
NakataCode
reviewed
Jun 18, 2026
| it("fires click event on Enter and Space", () => { | ||
| basicTemplate(); | ||
|
|
||
| cy.get("#shellbarBranding").then(branding => { |
Contributor
There was a problem hiding this comment.
You can use the attribute selector instead of the id selector.
Comment on lines
148
to
169
| _onkeydown(e: KeyboardEvent) { | ||
| if (isSpace(e)) { | ||
| if (isEnter(e) && !this.href) { | ||
| this._activate(e); | ||
| e.preventDefault(); | ||
| } else if (isSpace(e)) { | ||
| e.preventDefault(); | ||
| } | ||
| } | ||
|
|
||
| _onkeyup(e: KeyboardEvent) { | ||
| if (!isSpace(e)) { | ||
| return; | ||
| } | ||
|
|
||
| if (isEnter(e)) { | ||
| this._fireClick(); | ||
| this._activate(e); | ||
|
|
||
| if (this.href && !e.defaultPrevented) { | ||
| const customEvent = new MouseEvent("click"); | ||
| customEvent.stopImmediatePropagation(); | ||
| this.getDomRef()!.dispatchEvent(customEvent); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
The && !this.href guard on Enter prevents ui5-click from firing when href is set. The getDomRef().dispatchEvent(new MouseEvent("click")) for Space+href navigation has no effect since the click is dispatched on the host element, not the inner .
…bcomponents into fix-shellbar-branding-click-2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"Space" key now triggers "click" event on Shellbar Branding.