sap.ui.core.CommandExecution: executable only on tabbable elements
See original GitHub issueURL (minimal example if possible)
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
- Open the above sample page
- 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). - 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:
- Created 4 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
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.
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