-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[lexical-react] fix: ensure attributes are set immediately on menu #7237
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
As you've mentioned this does fix some problems, but other issues remain primarily due to the id conflict that now arises since all of the menus are rendered concurrently. e.g. this code no longer works correctly (due to prior regressions): const scrollIntoViewIfNeeded = (target: HTMLElement) => {
const typeaheadContainerNode = document.getElementById('typeahead-menu');
if (!typeaheadContainerNode) {
return;
} |
Perhaps a path for a short term fix might be to only assign the id to the active menu, so there's only one typeahead-menu in the document at a time. That probably wouldn't require changing the tests and other logic that depends on the typeahead-menu id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and seems to work well with manual testing in the playground, nice job! Will merge assuming the extended test suite is clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there are some test failures, I don't think it's meaningful to perform this specific test on collab so we should just skip it there
Description
With the changes introduced in Lexical 0.25.0 (notably #7181 and #7164), the menu now renders immediately. However, this has led to two issues:
1. Missing attributes on initial render
The menu container
<div>
is rendered before its attributes are assigned. As a result:anchorClassName
are not applied immediately, causing visibility issues. The attributes only appear after the user makes further inputs. In my case, the menu is covered by a dialog because thez-index
from my custom class is not applied initially.role
andaria-label
, make automated testing more difficult.2. Persistent DOM Element (not addressed in this PR)
The menu container
<div>
remains in the DOM even when the menu is closed. This can lead to duplicate IDs, potentially causing accessibility and testing issues.Fix in This PR
This PR ensures that all attributes are correctly assigned as soon as the menu is rendered.
Before
After