Skip to content

Conversation

alex-ju
Copy link
Member

@alex-ju alex-ju commented Jun 19, 2025

πŸ“Œ Summary

Fix destructor when <dialog> is open and the component is destroyed.

πŸ› οΈ Detailed description

Pre 4.19, the page overflow property was always reset after the <dialog> was closed.

In a recent refactor intended as a fix the overflow property was reset only when the <dialog> was closed.

There are instances across products where the Modal component is destroyed without being properly closed. By properly closed I mean using the close function (via the close button on the top right corner of the dialog, or via a footer button bound to this action), clicking outside of the dialog or pressing the escape key. When this happens the page overflow is not reset.

To avoid such instances I suggest we emulate the close() event if the <dialog> is removed from the DOM while open, so it behaves similar to close action.

Borrowed the showcase example from #2961 and added a test to cover this scenario.

πŸ”— External links

Jira ticket: HDS-4975


πŸ‘€ Component checklist

πŸ’¬ Please consider using conventional comments when reviewing this PR.

πŸ“‹ PCI review checklist
  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
  • If applicable, I've worked with GRC to document the impact of any changes to security controls.
    Examples of changes to controls include access controls, encryption, logging, etc.
  • If applicable, I've worked with GRC to ensure compliance due to a significant change to the in-scope PCI environment.
    Examples include changes to operating systems, ports, protocols, services, cryptography-related components, PII processing code, etc.

@alex-ju alex-ju requested a review from a team as a code owner June 19, 2025 23:44
Copy link

vercel bot commented Jun 19, 2025

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
hds-showcase βœ… Ready (Inspect) Visit Preview Jun 20, 2025 9:00am
hds-website βœ… Ready (Inspect) Visit Preview Jun 20, 2025 9:00am

Copy link
Contributor

πŸ“¦ RC Packages Published

Latest commit: 050a522

Published 2 packages

@hashicorp/design-system-components@4.20.2-rc-20250620095749

yarn up -C @hashicorp/design-system-components@rc

@hashicorp/flight-icons@3.11.1-rc-20250620095749

yarn up -C @hashicorp/flight-icons@rc

@didoo didoo mentioned this pull request Jun 20, 2025
5 tasks
@alex-ju
Copy link
Member Author

alex-ju commented Jun 20, 2025

closing in favour of other approaches

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.

2 participants