Skip to content

Fix SelectableLabel text shift with inactive strokes#8276

Draft
sjh9714 wants to merge 1 commit into
emilk:mainfrom
sjh9714:fix-selectable-label-stroke-jitter
Draft

Fix SelectableLabel text shift with inactive strokes#8276
sjh9714 wants to merge 1 commit into
emilk:mainfrom
sjh9714:fix-selectable-label-stroke-jitter

Conversation

@sjh9714

@sjh9714 sjh9714 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Button::atom_ui used the stroke-compensated frame margin even when an inactive frameless selectable button did not paint that stroke. With a non-zero inactive bg stroke, the text jumped when hovering and the hover frame was painted.

This restores the unpainted stroke padding for the inactive/no-frame path only, and adds a kittest regression that compares the text shape position before and after hover.

Testing

  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p egui_kittest selectable_label_text_should_not_shift_when_inactive_stroke_is_unpainted -- --nocapture (failed before the fix with [11.0 9.5] vs [12.0 9.5], passes after)
  • PATH="$HOME/.cargo/bin:$PATH" cargo fmt --check
  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p egui_kittest --test regression_tests (passes; two pre-existing warnings in override_text_color_affects_interactive_widgets)
  • PATH="$HOME/.cargo/bin:$PATH" cargo test -p egui
  • PATH="$HOME/.cargo/bin:$PATH" cargo clippy -p egui -- -D warnings
  • PATH="$HOME/.cargo/bin:$PATH" cargo clippy -p egui -p egui_kittest --test regression_tests -- -D warnings (fails on existing clippy::unnecessary_wraps in crates/egui_kittest/src/app_kind.rs:26)
  • git diff --check

I opened this as draft because I did not run ./scripts/check.sh.

Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.

@github-actions

Copy link
Copy Markdown

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/8276-fix-selectable-label-stroke-jitter

View snapshot changes at kitdiff

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.

Button::selectable (SelectableLabel) shifts content by inactive.bg_stroke.width px on hover when frame_when_inactive = false

1 participant