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

Focus inside input field on show show input modal #10789

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

Darshan-upadhyay1110
Copy link
Contributor

Change-Id: I5a29ddf7b4562221fc8a6c574a775d2a2e9180a8

  • Resolves: #
  • Target version: master

Summary

TODO

  • ...

Checklist

  • I have run make prettier-write and formatted the code.
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

@@ -1570,6 +1570,9 @@ L.Control.UIManager = L.Control.extend({
that.closeModal(dialogId);
}}
]);

// focus on input modal on show
document.getElementById('input-modal-input').focus();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to avoid getElementById where possible.
Also: why not put this inside showModal function? then in all places where we show modal we will focus it, not only in this case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have to, better to query inside container: container.querySelector('#id')
that makes us sure we will not get element from some other place than our current component/dialog

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eszkadev found better way :)

It seems it was a regression from my commit when i did fix for tabcontrol focus #10795

@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/fix-focus-input-modal-on-show branch from 73fe57e to 512bb90 Compare December 26, 2024 13:23
@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/fix-focus-input-modal-on-show branch 2 times, most recently from 1276de9 to 1a69611 Compare December 26, 2024 13:28
- fix regression caused by #10795
- need to handle both tabcontrol element and single init focus element

Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I5a29ddf7b4562221fc8a6c574a775d2a2e9180a8
@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/fix-focus-input-modal-on-show branch from 1a69611 to 49648c3 Compare December 27, 2024 10:23
Copy link
Contributor

@eszkadev eszkadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok

@eszkadev
Copy link
Contributor

can we have some cypress test which will check that initial focus?

@eszkadev eszkadev merged commit 7324139 into master Dec 27, 2024
14 checks passed
@eszkadev eszkadev deleted the private/darshan/fix-focus-input-modal-on-show branch December 27, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants