Skip to content

Tabs widget: tab names invisible in the overflow menu until hovered - #4040

Open
amichelotti wants to merge 1 commit into
ControlSystemStudio:masterfrom
infn-epics:fix/tabs-overflow-menu-text
Open

amichelotti wants to merge 1 commit into
ControlSystemStudio:masterfrom
infn-epics:fix/tabs-overflow-menu-text

Conversation

@amichelotti

Copy link
Copy Markdown
Contributor

When a Tabs widget has more tabs than fit, the drop-down list of tabs (the TabPane overflow menu) shows the entries only on the hover highlight: the tab names are drawn in the menu's background color.

Cause

TabsRepresentation puts the tab title in a Label graphic, with a " " tab text, so that the font can be set, and colors that label black in code. TabPaneSkin builds each overflow menu item from the tab text and a copy of the graphic (TabPaneSkin.clone()), which only carries the label's text, so the entries are drawn with the menu's default text color.

Fix

Use the tab's own text for the title, and set the font (JFXUtil.cssFont) and text color (-fx-text-base-color, used by modena.css for the tab label) through the tab's style, next to the existing -fx-base shading. The tab label inherits them, so the headers look as before, and the overflow menu gets regular, readable items.

Testing

  • JavaFX 25 TabPane with the same styling and more tabs than fit: the overflow menu lists all names readably, headers keep the configured font in black.
  • app/display/representation-javafx builds and its tests pass.

The tab title was a Label 'graphic' next to a " " tab text, so that the font
could be set. When not all tabs fit, the TabPane's overflow menu lists them
with a copy of that graphic, which keeps the text but not the color set on
the original, so the entries were drawn in the menu's default text color and
were only readable on the hover highlight.

Use the tab's own text for the title and set font and text color through
the tab's style, which the tab label inherits. The overflow menu then shows
regular, readable entries.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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