Skip to content

fix: Refocus only on internal components#7044

Open
GZolla wants to merge 2 commits into
mainfrom
gzolla/tag-list-refocus
Open

fix: Refocus only on internal components#7044
GZolla wants to merge 2 commits into
mainfrom
gzolla/tag-list-refocus

Conversation

@GZolla
Copy link
Copy Markdown
Contributor

@GZolla GZolla commented Jun 4, 2026

GAUD-9997

The resize logic was refocusing on the active element since the calculations were setting visibility: hidden and causing focus to be lost. However, it was refocusing on ANY element in the DOM, causing components like the html editor to loose their current state(e.g. editing).

This PR simply adds guards to check that the focus element is actually part of the tag-list

@GZolla GZolla requested a review from a team as a code owner June 4, 2026 19:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-7044/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

async _handleResize() {
const refocus = getComposedActiveElement();
let refocus = getComposedActiveElement();
if (!isComposedAncestor(this, refocus)) refocus = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible to add automated tests to make sure if this is changed in the future is because it was intended and try to avoid any regressions ? I would request the same for the change below is that makes sense

Copy link
Copy Markdown
Contributor

@dbatiste dbatiste left a comment

Choose a reason for hiding this comment

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

Test would be worthwhile. Otherwise looks good.

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.

3 participants