Skip to content

refactor: add overlay.restoreFocusNode and vaadin-overlay-closing event - #3144

Merged
tomivirkki merged 4 commits into
masterfrom
overlay-api-additions
Dec 8, 2021
Merged

tomivirkki merged 4 commits into
masterfrom
overlay-api-additions

Conversation

@tomivirkki

@tomivirkki tomivirkki commented Dec 2, 2021 •

Copy link
Copy Markdown
Member

Needed by #3104

Changes derived as a separate PR from #3138

Add new API to <vaadin-overlay>:

  • restoreFocusNode: If set, the overlay will focus restoreFocusNode on close instead of the automatically obtained reference to the last focused element before the overlay got opened.
  • "vaadin-overlay-closing" -event: Dispatched when the overlay will be closed. The existing "vaadin-overlay-close" doesn't guarantee the overlay will be closed, because canceling the event also cancels the overlay closing.

@tomivirkki
tomivirkki force-pushed the overlay-api-additions branch from 29b22df to c4224be Compare December 7, 2021 11:47
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Dec 8, 2021

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tomivirkki tomivirkki changed the title feat: restoreFocusNode and vaadin-overlay-closing refactor: restoreFocusNode and vaadin-overlay-closing Dec 8, 2021
@tomivirkki tomivirkki changed the title refactor: restoreFocusNode and vaadin-overlay-closing refactor: overlay restoreFocusNode and vaadin-overlay-closing Dec 8, 2021
@tomivirkki tomivirkki changed the title refactor: overlay restoreFocusNode and vaadin-overlay-closing refactor: add overlay.restoreFocusNode and vaadin-overlay-closing event Dec 8, 2021
@tomivirkki
tomivirkki merged commit 996e4ec into master Dec 8, 2021
@tomivirkki
tomivirkki deleted the overlay-api-additions branch December 8, 2021 09:28
@jouni

jouni commented Dec 8, 2021

Copy link
Copy Markdown
Member

Maybe it’s just me, but I find the event naming slightly confusing (close vs closing). Not a big issue, as documentation will make it clear.

For the future self: I’d consider using vaadin-overlay-will-close of vaadin-overlay-closed for the even that is fired when the overlay will close / is definitely closed. Though, I’m not sure that’s any more clear, might just be completely subjective how these are perceived. Could benefit from light user testing. But as said, this is a minor issue, so let’s not do any changes 😄

@tomivirkki

Copy link
Copy Markdown
Member Author

Note that the overlay API is for internal purposes only. We can rename it anytime.

@tomivirkki

Copy link
Copy Markdown
Member Author

We were earlier discussing an additional event (doesn't exist yet), that would dispatch after vaadin-overlay-closing once also the possible closing animation has fully finished. Maybe vaadin-overlay-closed would work better for that.

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with platform 23.0.0.alpha1 and is also targeting the upcoming stable 23.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants