Skip to content

Conversation

@tavanuka
Copy link

Resolves #512.

This PR aims to add escape key handling support for modal instances by having a global handler which programmatically closes last-most instance when the escape key is pressed.

Instead of registering a handler per instance, a global handler is registered once via JavaScript and bypasses using event handlers.

Although I am not the biggest fan of JS, I see no other way for this use-case to be solved. This solution should also mitigate any weird and inconsistent behaviours that occurred with the previous fix caused by #201 and #202.

Additionally, support for disabling escape key handling can be set globally, or per-instance.

I have extended the unit tests to ensure coverage of the newly added feature.

@chrissainty If possible, a review and potential merge would be optimal - as we use this dependency in the customer's project extensively and its requirement is better accessibility. I was assigned to implement this feature, with additional colleague tasked to do a review of my changes - as they do not wish to resort to having to compile a fork.

@tavanuka
Copy link
Author

Workflow action requires approval to be executed.

@NeskireDK
Copy link

Clear and simple solution, that aligns perfectly with existing code. Its a thumbs up from me, ill unsubscribe the #512 in hopes that this will be merged in.
Fair warning though, I haven't got a code base handy to test it myself.

@tavanuka
Copy link
Author

@NeskireDK Thank you. Code has been internally tested by my colleague and vibe checked in case I have done any hiccups. According to him: "LGTM"

@tavanuka
Copy link
Author

I will add a documentation entry describing this feature. I forgot about this

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allowing user to press ESC to exit modal window.

2 participants