question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sap.ui.core.CommandExecution: executable only on tabbable elements

See original GitHub issue

URL (minimal example if possible)

https://openui5nightly.hana.ondemand.com/entity/sap.ui.core.sample.Commands/sample/sap.ui.core.sample.Commands

Given

<Page id="page" title="Commands">
  <dependents>
    <core:CommandExecution id="CE_SAVE"
      command="Save"
      execute=".onSave" />
"sap.ui5": {
  "commands": {
    "Save": {
      "shortcut": "Ctrl+S"
    }

Steps to reproduce the problem

  1. Open the above sample page
  2. Click on the Page / on any Panel body to remove the focus from the current focused element (The click should be still within the Page area where <core:CommendExecution> applies).
  3. Press <kbd>Ctrl+S</kbd>

What is the expected result?

.onSave is triggered. Being able to use shortcuts more “broadly” (No need to focus an element first).

What happens instead?

The command execution feature seems to be unaware of any shortcut presses if no element has the focus (sap.ui.getCore().getCurrentFocusedControlId() returning null). Hence, pressing <kbd>Ctrl+S</kbd> from the Page/Panel itself (which is not tabbable) executes browser’s default save action.

Any other information? (attach screenshot if possible)

It would be nice if the corresponding command could be executed even if no element is actually focused at that moment. I believe an alternative approach needs to considered. In the current state, from the viewpoint of app developers and end users, it seems a bit unnatural having to find the a focusable element first, focusing it, and then pressing <kbd>Ctrl+S</kbd>.

Clicking on the Popover body and then pressing <kbd>Ctrl+S</kbd> does trigger .onSave since it has tabindex="-1". But the Page/Panel body doesn’t contain any tabindex.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
flovogtcommented, Mar 4, 2022

Hi @boghyon , we discussed this topic multiple times in the team and we came to the conclusion that we can not provide a stable non confusing implementation of focus-free shortcuts. The application has to ensure to set the focus before the shortcut is executed.

1reaction
IlianaBcommented, Jan 15, 2020

Hello @boghyon ,

The responsible team is informed about the suggested enhancement. The internal discussion may take some time but the issue will be updated once a decision is made.

Regards, Iliana

Read more comments on GitHub >

github_iconTop Results From Across the Web

sap.ui.core.CommandExecution - API Reference - Demo Kit
Creates and initializes a new CommandExecution. The CommandExecution registers a shortcut when it is added to the dependent aggregation of a control.
Read more >
Tabindex on UI5 table for only editable fields - SAP Community
Hi, When I currently use the TAB Key in a table, the cursor is going to the next component of the screen, and...
Read more >
Tab Index for UI elements - SAP Community
Hiii Everyone, I have a view which is like an entry form and i want to set the focus for the elements in...
Read more >
Navigating through Input fields via TAB - SAP Community
I already googled how to achieve this using SAP UI5 and all i came across is setting the tabindex attribute via jQuery. Is...
Read more >
Search Results - CVE
The mission of the CVE® Program is to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found