Skip to content
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

Dialog: initial focus not applied on open #2537

Closed
ilhan007 opened this issue Dec 1, 2020 · 4 comments · Fixed by #2551
Closed

Dialog: initial focus not applied on open #2537

ilhan007 opened this issue Dec 1, 2020 · 4 comments · Fixed by #2551
Assignees
Labels
bug This issue is a bug in the code High Prio SAP MDK TOPIC RD

Comments

@ilhan007
Copy link
Member

ilhan007 commented Dec 1, 2020

Describe the bug
The focus does not go to the focusable element in the dialog when it opens.
Note: The bug is not reproducible in our examples.

To reproduce
Steps to reproduce the behavior:

  1. Go to https://mobile-development-kit-mobile-qa-nsblrmdkwebtestapp-approuter.cfapps.ap11.hana.ondemand.com/nsBLRMDKWebTestApp/index.html
  2. Use your corporate mail and windows/macOS password to log in
  3. Click the last item from the list "PLT Format Support"
  4. Click "FormCell test cases"
  5. Find the input field (ui5-textarea) with value "UPPER CASE IN WEB"
  6. Type any letter - f.e "a"
  7. Dialog opens upon typing, but the focus remains in the input field and you can continue typing, which will open other instances of Dialog

Comment
The "applyFocus" method is called before the Shadow DOM of the Dialog is ready, as consequence no focusable
element is found. We have to ensure that the Dialog is really open, the DOM is ready, and then call "applyFocus".

I also asked the app developer (from where the issue origins) to check if calling "applyFocus" "onAfterRendering" would fix the issue.

// Popup.js
onAfterRendering() {
      this.applyInitialFocus();
}

Screenshot 2020-12-02 at 10 11 23 AM

As you can see the time the applyFocus is called, the footer is not displayed, seems it is about to be slotted by the browser.
Using setTimeout resolves the issue.

onAfterRendering() {
    setTimeout(() => {
          this.applyInitialFocus();
     }, 0);
}

Video
Screen Recording 2020-11-25 at 3.15.40 PM.mov.zip

Expected behavior
The button in the Dialog's footer should be the element on focus after the Dialog opens

Context

  • UI5 Web Components version: latest
  • OS/Platform: {...} MacOS
  • Browser (if relevant): {...} Chrome
  • Other information: {...}

Affected components (if known) ui5-dialog (Popup)

@ilhan007
Copy link
Member Author

ilhan007 commented Dec 1, 2020

FYI @SAP/ui5-webcomponents-topic-rd

@alexandar-mitsev alexandar-mitsev self-assigned this Dec 4, 2020
alexandar-mitsev added a commit to alexandar-mitsev/ui5-webcomponents that referenced this issue Dec 7, 2020
Now the initial focus is applied also in cases when the dialog
is opened before it is fully rendered.

Fixes: SAP#2537
alexandar-mitsev added a commit to alexandar-mitsev/ui5-webcomponents that referenced this issue Dec 8, 2020
Now the initial focus is applied also in cases when the dialog
is opened before it is fully rendered.

Fixes: SAP#2537
MapTo0 pushed a commit that referenced this issue Dec 14, 2020
Now the initial focus is applied also in cases when the dialog is open before it is fully rendered.

Fixes: #2537
niyap pushed a commit to niyap/ui5-webcomponents that referenced this issue Dec 17, 2020
Now the initial focus is applied also in cases when the dialog is open before it is fully rendered.

Fixes: SAP#2537
@ilhan007
Copy link
Member Author

Hello @alexandar-mitsev

After upgrading the test system with version that includes the fix, the MDK colleagues found out that the issue is still present - the focus does not apply as expected.

The steps to reproduce are the same.
The web components are bundled in "web-ui~46a5c7d5.bundle.js" where you can see that the app has the fix:

Screenshot 2021-01-14 at 7 12 38 AM

BR,
ilhan

@ilhan007 ilhan007 reopened this Jan 14, 2021
@ilhan007 ilhan007 removed this from the 1.0.0-rc.11 milestone Jan 14, 2021
@ilhan007 ilhan007 added bug This issue is a bug in the code customer and removed customer labels Jan 14, 2021
@georgimkv
Copy link
Contributor

Awaiting system to be updated to last release of ui5-webcomponents to check if #2679 fixes with the problem.

@georgimkv
Copy link
Contributor

Hi @ilhan007, the system running on the latest version of ui5-webcomponents no longer observes the reported bug.

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 High Prio SAP MDK TOPIC RD
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

3 participants