* Closes <https://github.com/emilk/egui/issues/2550>
* [x] I have followed the instructions in the PR template
Double-click-and-drag now extends the selection by whole words, and
triple-click-and-drag by whole lines — in both `TextEdit` and labels,
including selections spanning multiple labels.

The reason this was missing: clicks are only counted on pointer
*release*, so at the start of a drag nothing knew it began with a
double-click.
* `PointerState` now also computes the would-be click count at *press*
time (`pub(crate)` only, same heuristics as the click counting on
release).
* On a second/third press, `TextCursorState` selects the word/line under
the pointer immediately and remembers it as the anchor; while dragging,
the selection is the union of the anchor and the word/line under the
pointer. A side effect is that plain double-click selection now appears
on press rather than release, matching other UI toolkits.
* `LabelSelectionState` carries the anchor across passes, so the drag
can extend into neighboring labels.
No public API changes. Covered by unit tests for the range math and
kittest tests for `TextEdit` (forward/backward/lines) and cross-label
drags in `tests/egui_tests/tests/test_text_selection.rs`.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Closes <https://github.com/emilk/egui/issues/5852>
* [x] I have followed the instructions in the PR template
Selecting text in a `Label` or a `TextEdit` now fills the PRIMARY
selection, and middle-clicking a `TextEdit` pastes it. This is what all
other X11 and Wayland applications do.
Testing: `tests/egui_tests/tests/test_primary_selection.rs`. Publishing
from labels and text edits, no publishing of passwords, no re-claiming
of an unchanged selection, nothing at all on non-PRIMARY platforms,
pasting at the click position rather than at the cursor, and no paste
from a click outside the widget.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
I have found that `ui.horizontal(...).response.on_hover_text(...)`
doesn't work, although [documentation says
otherwise](https://docs.rs/egui/latest/egui/struct.Ui.html#method.horizontal):
> The returned
[Response](https://docs.rs/egui/latest/egui/response/struct.Response.html)
will only have checked for mouse hover but can be used for tooltips
(on_hover_text). It also contains the
[Rect](https://docs.rs/egui/latest/egui/struct.Rect.html) used by the
horizontal layout.The returned
[Response](https://docs.rs/egui/latest/egui/response/struct.Response.html)
will only have checked for mouse hover but can be used for tooltips
(on_hover_text). It also contains the
[Rect](https://docs.rs/egui/latest/egui/struct.Rect.html) used by the
horizontal layout.
So I added fix to this into tooltip, but this looks like a hack, and I
don't know a better place to do so. Do you have a better idea?
This PR is split into two commits: first commit adds test, and you can
see wrong behaviour in the image. Second commit fixes this and also
regenerates the image and you can now see tooltip.
I have used LLM to help me with this PR (codex). And I retained LLM
comment, because such hacks should have some comments, and it seems ok
to me.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
Compiler optimization will replace these later on, but when building
without optimization they will (most often) stay divisions and divisions
are clearly slower than multiplications.
Note that the `/ 2.5` replacement is not bit-exact (since 0.4 cannot be
represented exactly, but 2.5 can), but my guess is that the
approximation is good enough. The others should be bit-exact.
(Division by 2 for unsigned numbers will be replaced to >>1 earlier in
the compile chain, so no point in doing the same there.)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Follows #8665
* Follows #8662
Content can now be pulled past the edge of a `ScrollArea` with
increasing resistance, and springs back when released, like iOS/macOS. A
flick that coasts into the edge bounces too.
**Input paths**
* **Drag-to-scroll** (touch): rubber-bands on drag, bounces on kinetic
coast.
* **Trackpad, fingers down**: rubber-bands mid-gesture, holds while
fingers rest, springs back on lift.
* **Trackpad, OS momentum phase** (macOS): bounces once off the edge,
then the rest of the momentum is ignored. Momentum arriving while
already past the edge is ignored, so it doesn't overshoot.
* **Mouse wheel / web** (no phases): still hard-clamps, like macOS.
* Scroll bars and `scroll_to_*` unchanged.
**Scroll chaining** is preserved: an inner scroll area already at its
edge when a trackpad gesture starts passes the delta to an enclosing
scroll area. The outermost area rubber-bands at its edge.
**Structure**: `scroll_physics.rs` holds the maths (iOS resistance
curve, exact critically damped spring, exact kinetic decay) and the
per-axis rules (`drag`, `step`, `wheel`) as a 1D stateless
`AxisPhysics`, with unit tests. `scroll_area.rs` keeps only the glue:
build the per-axis physics, call one method per input path, remember
which axes to leave unclamped this frame.
**API**
* `State::offset` is now private, since it may be outside the valid
range while rubber-banding. Read it via `State::clamped_offset()` (what
the old field used to be) or `State::unclamped_offset()` (where the
content is drawn), plus `State::overscroll()`. A deprecated
`State::offset()` returns the clamped one. `State::velocity()` is now in
offset space (positive = scrolling down/right).
* `KineticScrollStyle::rubber_band: bool` to turn it off. Slope (0.55)
and spring time (0.1 s) are constants.
**Tests**: 8 unit tests on the physics and rules (resistance curve,
spring, coast distance, frame-rate independence, chaining, momentum
bounce-once and no-overshoot), plus one kittest test wiring a touch drag
through `ScrollArea`.
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
When `debug_on_hover_with_all_modifiers` is enabled, holding down all
modifier keys lets you hover widgets to see where they were created.
Previously this didn't work for tooltips, since moving the pointer
towards a tooltip would close it.
Now, while all modifiers are held:
* An open tooltip stays open
* The tooltip is made interactable, so its contents can be
hovered/inspected
* Tooltips shown `at_pointer` freeze in place instead of following the
pointer
Includes a regression test.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Broken out of #8617.
* `TextEdit::margin` now makes room for the stroke inside the margin
(like the theme does), so the stroke width changing on hover/focus no
longer causes a layout shift.
* `TextEdit::clip_text(false)` now expands the widget to make all text
visible, as documented, instead of being capped at `desired_width`.
* The default `TextEdit` inner margin is now `spacing.button_padding`,
and the theme gives `TextEdit` the same min height (`interact_size.y`)
as a `Button`, so they always have the exact same height (previously off
by 1px).
Tests added to `test_widget_heights.rs`: text edit included in the
matching-heights test (now run for several `interact_size.y` values),
size stable on hover/focus (with and without custom margin), and
unclipped text edit grows to fit text.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* [x] I have followed the instructions in the PR template
Adds `egui::Aligned`, a container that places its contents at a given
`Align2` within the available space of the parent `Ui`, e.g. in the
bottom-right corner.
Since the size of the contents isn't known up front, it remembers the
size from the previous pass. On the first pass the contents are added
invisibly and a new pass is requested with `request_discard`, so there
is no flicker.
```rust
egui::Aligned::new(egui::Align2::RIGHT_BOTTOM).show(ui, |ui| {
ui.label("Bottom right");
let _ = ui.button("Click me");
});
```
Like a `Panel`, `Aligned` reserves space in the parent `Ui` along its
main axis: if the contents are aligned to the end of that axis (e.g. the
bottom of a vertical `Ui`), widgets added afterwards go in the space
*before* them. So you can put something in the bottom-right corner and
keep adding widgets above it:
```rust
egui::Aligned::new(egui::Align2::RIGHT_BOTTOM).show(ui, |ui| {
let _ = ui.button("Bottom right");
});
ui.label("Placed above the button");
```
Rerun uses this to overlay the legend on a plot.
Extracted from Rerun's `re_ui::egui_ext` (where it is called `Group`).
Naming suggestions welcome.
Written by Claude (LLM).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
A font family with no font at all used to lay out to an *empty galley*:
the run had no face to shape with, so it was dropped.
`Galley::clamp_cursor` on that empty galley returns 0, so a `TextEdit`
lost its cursor the frame after typing — text stayed, cursor jumped to
0, and e.g. completion popups never opened. Found in rerun's tests after
dropping `default_fonts`, where nothing installed a font for the bare
kittest harness.
### Changes
* epaint: a family without fonts now lays out **one synthetic tofu box
per grapheme cluster**, with metrics derived from the font size.
`glyphs.len() == char_count` and non-zero row heights hold even with no
font.
* epaint: new `MissingGlyphPolicy { Tofu, Panic }` on `Fonts`, consulted
only after every font, `FontProvider` and `GlyphRasterizer` had its
turn. Control characters (`\t`, `\n`, …) never panic, since fonts have
no glyphs for them. The panic names the character, the family and the
installed fonts.
* egui: `Context::set_missing_glyph_policy` / `missing_glyph_policy`.
* egui_kittest: **panics on a missing glyph by default**, since tofu in
a snapshot is easy to miss. Opt out with
`HarnessBuilder::allow_missing_glyphs()`. One demo test needed it (the
emoji completion popup lists emoji the bundled fonts lack).
Top: with fonts, U+10FFFD drawn with Ubuntu's `.notdef`. Bottom: the
same UI with `FontDefinitions::empty()`, all synthetic tofu (3× zoom):
<picture>
<img
src="https://static.rerun.io/tofu_cmp/1c2a567a1f53c301897e716452974a0b6fbc8e12/full.png"
alt="">
<source media="(max-width: 480px)"
srcset="https://static.rerun.io/tofu_cmp/1c2a567a1f53c301897e716452974a0b6fbc8e12/480w.png">
<source media="(max-width: 768px)"
srcset="https://static.rerun.io/tofu_cmp/1c2a567a1f53c301897e716452974a0b6fbc8e12/768w.png">
</picture>
Written by Claude (LLM) together with @emilk.
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Stacked on #8581
**⚠️ Breaking ⚠️**
`egui_kittest` that every input widget (button, checkbox, slider, combo
box, text field, …) has an accessible name.
Opt out with `HarnessBuilder::with_accessibility_check(false)`, or run
it by hand with `Harness::check_accessibility`.
Running it over egui's own tests found real gaps, fixed here:
* An empty label (`checkbox(&mut b, "")`) took precedence over
`labelled_by`; now it is not set at all.
* `DragValue` is named after its prefix or suffix (it used to clear the
name).
* The color button has a name, with the color as its value.
* `TextEdit` lost its placeholder on frames where the selection changed.
* `Margin`, `CornerRadius` and the font-size slider name their inputs.
* The demos and kittest tests name their remaining inputs.
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
`WidgetRect::parent_id` used `Ui::id`, the stable id _scope_ shared by
sibling `Ui`s, while accesskit and `WidgetRect::id` use the per-`Ui`
`unique_id`. The `warn_if_rect_changes_id` debug check relies on
`parent_id` changing during a cascading id shift, but cascades propagate
through `unique_id`, not the scope id. So a parent's auto-id shifting
produced a false positive for every widget inside it.
Now `parent_id` is the parent's `unique_id`. Adds a regression test.
Known limitation: the child `Ui`'s own `WidgetRect` still warns in that
case, since its parent's id is genuinely unchanged. The heuristic cannot
tell that apart from a bug.
Found while working on:
* https://github.com/emilk/egui/pull/8542
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Closes#2744.
Adds `RangeSlider`: two handles selecting a sub-range, an editable value
at each end, and the accent fill between them.
Three commits:
**1. Move `Slider`'s geometry, painting and interaction into a private
`slider_core`.** No new `Visuals` field. The one rendering change: the
trailing fill is clamped to the rail, which moves it by under a pixel
for narrow rect handles.
**2. Add `RangeSlider` on top of it.** Rail, handles, hover growth,
`HandleShape` and the fill are the same code `Slider` runs, so the two
do not look different.
** 3. Added per-handle keyboard and screen-reader support. Each handle
is its own focus stop, so Tab reaches either end and the arrow keys move
the focused one. Each handle reports itself to AccessKit bounded by its
neighbour rather than by the end of the rail.
A separate widget rather than a mode on `Slider`, because none of this
means anything with one handle:
- the grabbed handle is remembered for the whole drag, so dragging one
handle past the other does not hand the pointer to its neighbour
- when the handles coincide, the side the pointer is on decides which
one moves
- `min_separation` sets how close they may come
One change: `paint_fill` takes a `Rangef` instead of a handle centre.
API changes from the review follow-ups:
- `Slider::prefix`/`suffix` take `impl IntoAtoms`, like `DragValue`, so
images and styled text work. Plain `char` or number arguments no longer
do.
- A prefix goes in front of any prefix already set, and a suffix after
any suffix already set, on `DragValue`, `Slider`, `RangeSlider`, and
`TextEdit`. `Slider` and `TextEdit` used to replace.
- `ValueFormat`, `SliderSpec`, and `DragValueSettings` are public, with
`format()`, `spec()`, and `drag_value()` builders on both sliders.
- `DragValue::atoms()` returns `Atoms` by value.
Snapshots: the new gallery row changes `widget_gallery_*` and
`demos/Scene` (the Scene demo embeds a Widget Gallery). `RangeSlider` is
also added to `test_widgets.rs`, which adds two new snapshots.
Written with Claude (llm), I (gavrelina) have reviewed the code myself
(I did!).
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
An inspection request is served from a frame, and a minimized or
occluded window runs none: eframe skips the whole pass, and wgpu hands
out no surface texture. An inspector attached to a backgrounded app
could only time out.
* `ViewportCommand::RequestPaintWhileHidden` asks for a painted frame
from a hidden window. It rides the command channel, which already
reaches the integration while hidden (`run_logic` hands it the pending
commands), so `Context` needs nothing new.
* eframe paints when a pending action wants paint: that command, or a
screenshot, which asks for the same thing.
* egui-wgpu captures without a surface texture: the capture renders to
its own texture anyway, and only the present needs the surface. Pending
screenshot callbacks used to be dropped silently whenever the frame
could not be acquired, which also hit visible-but-occluded windows.
`egui_inspection` sends the command, so nothing raises or focuses the
window.
Repro and manual test: `cargo run -p test_inspection_hidden_window`.
Verified on macOS: screenshots and trees are served while the window is
minimized.
Replaces:
* https://github.com/emilk/egui/pull/8566
* [x] I have followed the instructions in the PR template
Written by Claude (LLM).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
`Ui::id` was easy to confuse with `Ui::unique_id`. It is the id of the
_scope_ the `Ui` belongs to: stable across frames, shared by sibling
`Ui`s, and the base for widget state ids. `Ui::unique_id` is unique per
`Ui` but unstable.
This renames `Ui::id` to `Ui::scope_id` (old name deprecated) and
rewrites both docstrings to say so.
Follow-up to discussion in:
* https://github.com/emilk/egui/pull/8534#discussion_r3969041538
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
`AtomLayout` kinda combined two seperate concerns, this logically
seperates them.
Also makes nested atoms a lot more lightweight, not requiring a
`Response`.
New widget `egui::CompletionPopup`: a code completion popup over a
`TextEdit`. ↑/↓ selects, Enter or Tab accepts, Escape closes, click
accepts. Keyboard focus never leaves the text field. The caller supplies
suggestions for the word under the cursor:
```rust
CompletionPopup::new(id).show(ui, TextEdit::singleline(&mut text), |query| suggest(query));
```
New example `code_completion` shows slash-command completion, with
headless `egui_kittest` tests for the arrow/Enter/Tab/Escape behavior,
including a multiline chat composer.
Builds on:
* https://github.com/emilk/egui/pull/8530
Note on Escape: egui surrenders focus on Escape in `Memory::begin_pass`,
before any widget runs. So an app that wants "Escape does X while the
text field is focused" must set `TextEdit::event_filter(EventFilter {
escape: true, .. })`, or the handler never sees the field focused. The
popup does this for you while it is open.

* Related: <https://github.com/emilk/egui/issues/122>
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
`GlyphRasterizer` now has a `FontPriority`:
* `FontPriority::Highest`: asked about every cluster, before any font.
Use it to override how specific glyphs looks
* `FontPriority::Lowest` (default): a fallback, only asked about
clusters no installed font (or `FontProvider`) has. Same as before.
Several rasterizers can be installed; within a tier they are asked in
order, and the first `Some` wins.
```rust
ctx.add_glyph_rasterizer(
egui::GlyphRasterizer::new(|request| (request.cluster == "…").then(|| my_ellipsis(request)))
.with_priority(egui::FontPriority::Highest),
);
```
API changes (all unreleased): `Context::set_glyph_rasterizer(Option)` →
`add_glyph_rasterizer` / `set_glyph_rasterizers(Vec)`, same on
`epaint::Fonts`.
Follow-up to:
* https://github.com/emilk/egui/pull/8512
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
`Id::new` and `From<&str> for Id` etc are foot-guns: they hide the fact
that an `Id` MUST be globally unique (well, at least unique within your
app).
So this PR removes both and replaces them with `Id::unique`, which is
very explicit.
In places where non-uniqueness is desired, you can use `IdSalt`, which
has the convenient `From<&str>`.
Most changes are in tests.
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Implements `StyleProvider` for `TextEdit`, so you can fully style it as
you please
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Extracts a shared struct with things that once might want to override
for any atomlayout-based widget.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
TextEdit has a min_size field but we completely ignored in the y
direciton. (I probably broke it in #7140).
---------
Co-authored-by: emilk <1148717+emilk@users.noreply.github.com>
Moves global classnames to e.g. `egui::class::ROOT`.
Widget specific classes live on the widgets struct.
Adds some more classes for our buttons styling options (`CLASS_SMALL`
etc), so that custom `StyleProvider`s can choose to implement them
differently or ignore them altogether.
Also removes some styleproviders that were partly or completely unused
(e.g. basestyle / labelstyle). We can add them back once we actually
implement styling for those.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
# What it does
Addition of a new system of theme plugins which allow the user to use
different rules engine to compute the style for the available
specialised widget style.
# How to use
Create a engine implementing the trait `ThemePlugin` and `ThemeStyle<S:
StyleStruct>` and implement the necessary methods, then register this
way (example for `ButtonStyle`):
```ui.add_theme::<ButtonStyle>(&mycustomengine);```
Now all button will call the `ThemeStyle<ButtonStyle>` method to compute the correct style and later use the cached value to avoid the costly computation.
If no valid `ThemeStyle<S>` or engine is available then it fallback to the default style.
* Closes part of <https://github.com/emilk/egui/issues/3284>
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: adrien <221212@umons.ac.be>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
* [x] I have followed the instructions in the PR template
Remove clippy lint groups already covered by `all` (`complexity`,
`perf`, `suspicious`, and the misspelled `correctnesss`), and two
individual lints covered by the `cargo` group (`negative_feature_names`,
`wildcard_dependencies`).
Add `publish = false` to the two internal crates that were missing it
(`popups`, `egui_tests`), which silences the
`clippy::cargo_common_metadata` warnings.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Closes <https://github.com/emilk/egui/issues/8266>
* Alternative to #8385
Not the most simple or beautiful code, but it works, and makes sense.
What makes it complex: `app.logic` should still see some input (e.g.
what viewports are visible) and emit some output (e.g. "open this link",
or "focus and repaint").
## TODO
* [x] test multiple viewports
## Clanker says
Instead of teaching egui to skip book-keeping during a pass where no ui
is shown, we simply run no pass at all. Then there is nothing to
special-case: all ui state is left untouched, and the app finds
everything where it left it when the window is shown again.
* New `Context::run_logic(&raw_input, f)`: ticks app logic without a
pass, returning the `LogicOutput` (platform output + viewport commands)
that a pass would otherwise have carried, so e.g.
`ViewportCommand::Focus` still reaches the integration.
* All three eframe backends (glow, wgpu, web) call `run_logic` instead
of `run_ui` when the viewport is minimized/occluded (and has no visible
descendant viewport) or, on web, when the tab is hidden.
* `App::logic` is still called from inside the pass when the window is
visible, so it sees the current frame's input.
While hidden, `run_logic` fills in only the window state
(`RawInput::viewports` / `focused`), so the app can tell that it is
hidden. The ui input (events, time, …) is not interpreted, and is
instead given to the next real pass.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
A fully collapsed `show_collapsible` panel now leaves a thin grab handle
at its fixed edge, invisible until hovered. Dragging it out past
`min_size` (or double-clicking it) reopens the panel. Opt out with
`panel.drag_to_open(false)`.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
A widget that senses both clicks and drags postpones the
click-versus-drag decision until the pointer moves past `max_click_dist`
or is held for `max_click_duration`. But a click has to be released *on*
the widget — so once the pointer leaves, the gesture can only be a drag,
and there is nothing left to wait for.
This matters for widgets thinner than `max_click_dist` (6px), such as
panel resize handles. The pointer leaves such a widget almost
immediately, which hands the hover to whatever is underneath, while
`dragged()` was not true yet. So a handle highlighting on `hovered() ||
dragged()` blinked out mid-gesture.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two fixes to the separator line of `Panel` (`resolve_frame` was added in
#8367):
* **Reserve room only when the line is always drawn.** Before,
`show_separator_line || resizable` reserved the line's thickness, so a
resizable panel that opted out still got a permanently visible gap along
its inner edge — space held for a line only drawn transiently, while
hovering or dragging the resize handle.
* **Paint the line outside the frame's outline**, in room reserved in
`Frame::outer_margin` rather than `inner_margin`, so going outwards from
the panel contents you get:
`contents | inner_margin | stroke | separator line | outer_margin`
Previously the line landed on top of the frame's outline (or outside its
outer margin). Default panels — no stroke, no outer margin — are
unchanged pixel-wise.
Found in the Rerun viewer: the time panel is
`.resizable(true).show_separator_line(false)` and draws its own top
line, so the extra 1pt landed above the top bar's buttons, making them
look 1pt too low.
Tests in `tests/egui_tests/tests/test_panel_separator_line.rs`, both
spanning `show_separator_line` on/off × resize handle hovered/not:
snapshots of a top panel with a garish outline, plus a pixel probe
across the inner edge of a panel on each of the four sides. Both fail on
`main`.
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Closes https://github.com/emilk/egui/issues/5605
It has been zero by default for a few months now, and I do not wish to
support it. It was always an ugly hack, and it is no longer needed.
Fixes two bugs around tooltips:
- During sizing pass tooltips would render at a different size, at which
point they might overlap the interacted widget causing the hover state
to change and the tooltip to never be shown
- Fix: During sizing pass make the area `interactable: false` so events
pass through
- When hovering close to the boarder of a widget (in the area where
`interact_radius` takes effect), there could be a feedback loop where
the tooltip is shown one frame and hidden the next.
- Fix: Always make tooltips `interactable: false` when they don't have
interactive contents
This PR changes the behavior of `Area::interactable` to it's original
behavior: Now interactions will pass through the area background _and_
it's containing widgets. It worked this way initially but got changed in
#4026
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
A `Button` used as a toggle (via `Button::selected(true)`,
`Button::selectable(...)`, or `Ui::selectable_label`) now announces its
pressed / not-pressed state to screen readers. Plain buttons that never
call `.selected(...)` stay un-toggled, so their announcement doesn't
change. `Checkbox` and the pre-existing selectable-label code path
already did this; `Button` was the odd one out.
No public API change: the field is private, `Button::selected(bool)`
keeps its signature, and visuals are identical. Internally the field
becomes `Option<bool>` so we can distinguish "plain button" from "toggle
button currently off".
Regression test added in `regression_tests.rs`, do let me know if some
other file would be a better location.
### Note for manual testing
`egui_demo_app` pulls in `eframe` with `default-features = false` and
doesn't re-enable `accesskit`, so `cargo run -p egui_demo_app` publishes
no AccessKit tree at all. To verify manually:
`cargo run -p egui_demo_app --features accessibility_inspector`
Happy to send a small follow-up PR enabling `accesskit` in the demo
app's defaults if that's desirable, since that makes a11y work much
easier to smoke-test locally.
### Use of AI
This PR was drafted with Claude Code. I understand different projects
have different policies regarding AI generated code. Do let me know if
this is not acceptable here. Also happy to take any other feedback.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Closes https://github.com/emilk/egui/issues/8217
* [x] I have followed the instructions in the PR template
## What
`AllocatedAtomLayout::paint` painted text via
`ui.painter().galley(...)`, so text in atom-based widgets could never be
selected. As discussed in #8217, routing it through
`LabelSelectionState::label_text_selection` unconditionally would break
`Button` / `Checkbox` / `RadioButton` / `TextEdit` (whose labels should
not be selectable, and whose click/drag handling would fight the
selection drag).
So this adds an **opt-in** `AtomLayout::selectable(bool)` (default
`false`). When enabled, the layout also senses clicks and drags
(mirroring `Label::layout_in_ui`) and paints its text through the
label-selection machinery. The underline is `Stroke::NONE`, so when
nothing is selected the painted output is identical to the existing path
— the default (`selectable == false`) behaviour, and existing snapshots,
are unchanged.
## Tests
Two tests in `tests/egui_tests/tests/test_atoms.rs`:
- `test_atom_selectable_senses_click_and_drag` — a `selectable(true)`
layout senses click+drag; the default stays inert.
- `test_atom_selectable_text_can_be_copied` — selecting (drag) the text
of a selectable layout and copying yields the text via
`OutputCommand::CopyText`, while a non-selectable layout yields nothing.
## Notes
- Verified locally: `cargo fmt --all -- --check`, `cargo clippy -p egui`
(clean), and the two new tests pass. I haven't run the full
`./scripts/check.sh` (wasm/typos) locally, hence opening as a draft.
- This only adds the opt-in API; no existing widget is made selectable.
Happy to wire it up on a specific widget and/or add an `egui_demo_lib`
demo if you'd like — just let me know.
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* Closes#8032
* [x] I have followed the instructions in the PR template
It includes:
* Fix for `ScrollArea` when `scroll_to_*` could be ignored when
`stick_to_bottom(true)` was active and the viewport was already stuck to
the bottom.
* The fix is by making explicit per-axis scroll movement take priority
over sticky-end snapping for that frame, and avoid immediately
re-marking animated scrolls as still stuck.
* I've also added a regression test for this issue to ensure it will be
caught on further code changes.
The code snippets form the original issue can be used for testing here
as well
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
The three methods for showing a `Panel` are now:
* `panel.show`: always show the panel.
* `panel.show_collapsible`: show or hide the panel, with a slide
animation in between.
* `Panel::show_switched`: animate between two different panels: a
thin/collapsed one and a thick/expanded one.
* Closes https://github.com/emilk/egui/pull/7254
You can now drag-to-close a panel. Also drag-to-expand panels.
This is a breaking change: the animated panel functions now take a
`open: &mut bool` instead of `open: bool`.
This is only enabled for resizable panels