-
Notifications
You must be signed in to change notification settings - Fork 276
fix(ui5-toolbar): fix ToolbarSelect flickering #11747
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
Fixes a flickering issue in ToolbarSelect
by adjusting item measurement and CSS application when the select overflows its toolbar.
- Scopes popover item width and alignment only when the select is overflowed
- Introduces a rendering flag to delay width measurement until after initial render
- Updates toolbar logic to skip items still rendering and adds an overflow behavior test
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
ToolbarSelect.css | Changed .ui5-tb-popover-item rules to apply only under is-overflowed and set width to 100% |
ToolbarSelect.ts | Conditional width style: unset when overflowed |
ToolbarItem.ts | Added _isRendering flag and onAfterRendering hook |
Toolbar.ts | Updated getItemWidth to ignore items while _isRendering |
Toolbar.cy.tsx | Introduced a Cypress test for overflow scenario (uses it.only ) |
Comments suppressed due to low confidence (1)
packages/main/cypress/specs/Toolbar.cy.tsx:410
- The use of
it.only
will cause all other tests to be skipped. Remove.only
to ensure the full test suite runs.
it.only("Should handle toolbar-select with width larger than the toolbar", async () => {
@@ -107,6 +109,10 @@ class ToolbarItem extends UI5Element { | |||
}, | |||
}; | |||
} | |||
|
|||
onAfterRendering(): void { |
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.
Override of onAfterRendering
does not call super.onAfterRendering()
, which may skip essential base-class rendering logic. Consider adding super.onAfterRendering()
at the start.
onAfterRendering(): void { | |
onAfterRendering(): void { | |
super.onAfterRendering(); |
Copilot uses AI. Check for mistakes.
@@ -60,6 +60,8 @@ class ToolbarItem extends UI5Element { | |||
@property({ type: Boolean }) | |||
isOverflowed: boolean = false; | |||
|
|||
_isRendering = true; |
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.
The _isRendering
flag is declared as a public property. It should be marked private
or protected
to indicate internal use and prevent external access.
_isRendering = true; | |
private _isRendering = true; |
Copilot uses AI. Check for mistakes.
@@ -498,7 +498,7 @@ class Toolbar extends UI5Element { | |||
|
|||
let itemWidth = 0; | |||
|
|||
if (renderedItem && renderedItem.offsetWidth) { | |||
if (renderedItem && !renderedItem.classList.contains("ui5-tb-popover-item") && renderedItem.offsetWidth && item._isRendering === false) { |
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 measurement condition is duplicated in getItemWidth
and the initial width calculation. Consider extracting it into a helper function or constant to avoid duplication and hard-coded class names.
Copilot uses AI. Check for mistakes.
No description provided.