Skip to content

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PetyaMarkovaBogdanova
Copy link
Contributor

No description provided.

Copy link
Contributor

@Copilot Copilot AI left a 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 {
Copy link
Preview

Copilot AI Jun 17, 2025

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.

Suggested change
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;
Copy link
Preview

Copilot AI Jun 17, 2025

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.

Suggested change
_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) {
Copy link
Preview

Copilot AI Jun 17, 2025

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.

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.

1 participant