Commit Graph
4634 Commits
Author SHA1 Message Date
Emil ErnerfeldtandClaude Opus 5.5 b4ebd0f910 Build ComboBox from atoms, and take impl IntoAtoms (#8618)
* Closes https://github.com/emilk/egui/issues/7903
* Part of https://github.com/emilk/egui/issues/7264

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:21:27 +02:00
Emil ErnerfeldtandClaude Opus 5.5 a1c276fc98 Hide invisible widgets from accessibility (#8621)
* Closes https://github.com/emilk/egui/pull/8606
* Root cause solution for https://github.com/rerun-io/reality/pull/3774

Our `Area`s mark themselves as invisible the first frame without calling
`request_discard`. They would still show up in the accessibility tree.

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 11:49:59 +02:00
Emil ErnerfeldtandClaude Opus 5.5 43a0913ec6 Fix NaN panic in Scene with zero scene_rect and unbounded zoom (#8622)
* Closes <https://github.com/emilk/egui/issues/8620>
* [x] I have followed the instructions in the PR template

With `scene_rect = Rect::ZERO`, `fit_to_rect_in_scene` computed an
infinite scale. The default zoom range (max `1.0`) clamps that, but
`0.0..=f32::INFINITY` does not, so the translation became `center - ∞ *
0 = NaN`, which ended up as a NaN widget rect and tripped the debug
assert in `create_widget`.

We now fall back to a 1:1 scale when the computed scale is not finite
and positive. This also covers the auto-reset path when the scene
contents are empty.

Added a regression test.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 08:25:06 +00:00
Emil ErnerfeldtandCopilot Autofix powered by AI a55f23a1ec Add BandShape (#8476)
Add `BandShape` to epaint, supporting and varying width band along some
direction.

This can be useful in egui_plot, e.g. for filling the area under a
curve, or for visualizing a audio waveform, for instance.

The band has feathering for the fill, plus an optional stroke that is
just drawn on top of the fill.

This solves a small subset of non-convex polygons (since the general
solution is quite difficult, at least if you want feathered edges).

<img width="493" height="180" alt="Screenshot 2026-09-01 at 20 56 33"
src="https://github.com/user-attachments/assets/f79ae9bc-3512-4c87-b166-d1240a8dd3e4"
/>

Includes an interactive waveform demo and alpha screenshot coverage.

Related work:

- https://github.com/emilk/egui/issues/513
- https://github.com/emilk/egui_plot/pull/260

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-22 12:27:54 +02:00
rustbasicandEmil Ernerfeldt 06921cda05 [performance] Avoid cross-viewport GalleyCache eviction (#8528)
[performance] Avoid cross-viewport GalleyCache eviction

This changes `Fonts` to keep `GalleyCache` entries partitioned by
viewport.

Previously, multiple viewports shared one galley cache. Since each
viewport flushes the cache at the start of its pass, root and child
viewports could repeatedly evict each other's text layouts.

As viewport text workload grows, this can force repeated layout of large
text contents and cause severe performance degradation, with the frame
rate dropping below 10 FPS in some cases.

Font data and the texture atlas remain shared. Only layout caches are
separated by an opaque viewport namespace.

* Closes #5249 
* Related #5836
* Related #7885 
* Related #8284
* Closes #8419

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2026-09-22 10:13:31 +00:00
Emil ErnerfeldtandClaude Fable 5.1 99df44a801 A TextEdit over an immutable buffer is read-only too (#8613)
Follow-up to #8611. Passing `&mut &str` is how `egui_commonmark` (and
the docs) show selectable text; it cannot be typed into any more than
`interactive(false)` can, so it now gets the same read-only mark, and
`egui_kittest` asks no name of it.

Written by Claude (an LLM) for @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>
2026-09-21 19:34:46 +00:00
Emil ErnerfeldtandClaude Fable 5.1 8709bd14b4 Add Area::role and UiBuilder::accessibility_role (#8612)
A `Ui` gets its accessibility role from its `UiKind` (#8581). This lets
a caller pick another one, e.g. `Role::Alert` for a toast:
`Area::new(id).role(Role::Alert).accessible_name("Saved")`, or
`UiBuilder::new().accessibility_role(role)` for any `Ui`.

Rerun sets the toast role by reaching into the node from inside the `Ui`
today; @emilk asked for a builder method instead.

Written by Claude (an LLM) for @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>
2026-09-21 19:10:35 +00:00
Emil ErnerfeldtandClaude Fable 5.1 f45d74baab A read-only text field needs no accessible name (#8611)
A non-interactive `TextEdit` (selectable text, e.g. the code blocks
`egui_commonmark` renders) now marks its node read-only, and the
`egui_kittest` check from #8589 leaves such fields alone: there is
nothing to type into, so nothing to reach by name.

Rerun was naming those code blocks "Code block" just to pass the check;
@emilk asked for this instead.

Written by Claude (an LLM) for @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>
2026-09-21 19:09:54 +00:00
Emil ErnerfeldtandClaude Fable 5.1 1c7109d090 Add Ui::label_inputs_by and Ui::name_inputs (#8608)
Two ways to name every input a closure adds that has no accessible name
yet:

* `ui.label_inputs_by(label.id, |ui| …)`: after a row label, for
property rows and forms whose label is painted apart from its value
widgets, so the editors need not know the row label.
* `ui.name_inputs("Code block", |ui| …)`: a fixed name, for widgets that
cannot be named where they are built, e.g. the read-only `TextEdit`
`egui_commonmark` renders for a code block.

Only the widgets registered on the `Ui`'s layer during the closure are
inspected (the per-layer widget list is in creation order), so the cost
is one node lookup per widget added, not a walk over the whole tree per
call. Both are what #8589's check asks for and what Rerun does by poking
at `accesskit_state` from outside egui today.

`egui::accessibility::is_input(role)` decides which roles count, as an
exhaustive match over `accesskit::Role`; `egui_kittest` uses the same
function.

Written by Claude (an LLM) for @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>
2026-09-21 15:21:41 +00:00
6def3661ec Add AccessKit support to panel resize handles (#8578)
Panel resize separators currently register no AccessKit content: screen
readers announce an empty node and cannot adjust the split (#8557). This
exposes the handle as a `Role::Splitter` (`WidgetType::ResizeHandle`)
labeled "Resize panel", with its orientation and the panel size as a
numeric value in `0..=1` of the available space.

AccessKit `Increment`/`Decrement`/`SetValue` requests on the handle are
translated into the same size-clamping path a pointer drag uses, and
`Increment` on a collapsed panel's grab handle expands the panel,
mirroring drag-to-expand. For headless testing, the `egui_kittest`
harness gains
`increment_accesskit`/`decrement_accesskit`/`set_value_accesskit` node
helpers. Tests assert the splitter node's label, orientation, numeric
bounds and supported actions, and verify that AccessKit actions move the
split.

Fixes #8557

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 14:21:02 +00:00
Lucas Meurer b30d20bca7 Ensure nested AtomLayouts have unique ids (#8556)
Buttons with nested atoms weren't fully clickable


https://github.com/user-attachments/assets/c9bc7075-9b32-4edc-9949-5eb047234e07
2026-09-21 13:09:01 +00:00
Emil ErnerfeldtandClaude Fable 5.1 4146d6366a Apply font changes right away while no text has been laid out this pass (#8609)
Generalizes #8602 from "no font loaded yet" to "nothing laid out yet
this pass": any font, provider, rasterizer or glyph-policy change made
before the first text of a pass takes effect in that pass, since nothing
is laid out with the old fonts.

#8602 missed the case where `default_fonts` is on: an app that installs
its own fonts during its first pass then laid that pass out with the
bundled fonts, and under `MissingGlyphPolicy::Panic` any glyph they lack
(Rerun's ⏎, on a Linux CI box with no system fonts) panics. New
`Fonts::used_since_begin_pass` is what the check reads.

Written by Claude (an LLM) for @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>
2026-09-21 15:07:42 +02:00
60b5f05e9a Remove WidgetType in favor of accesskit::Role (#8555)
- closes https://github.com/emilk/egui/issues/8474

Its a required dependency now so we might as well their type for best
compatibility

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 15:03:46 +02:00
Emil ErnerfeldtandClaude Fable 5.1 0777ca67aa Name a Ui, Area, Popup or Tooltip in the accessibility tree (#8607)
Follow-up to #8581, which gave every `Ui` a role. This adds the name:
`UiBuilder::accessibility_label` sets the label on the `Ui`'s node, and
`Area`, `Popup` and `Tooltip` take an `accessible_name` and pass it on.

A floating container can then be found by name
(`get_by_role_and_label(Role::Dialog, "Options")`) instead of by
reconstructing its node id. Rerun does that reconstruction today for its
modals, toasts and hover tooltips.

Written by Claude (an LLM) for @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>
2026-09-21 12:47:24 +00:00
Emil ErnerfeldtandClaude Fable 5.1 65bf96beae Add Response::accessible_name (#8604)
Useful for adding an accessibility name to a widget

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 12:17:58 +00:00
Emil ErnerfeldtandClaude Fable 5.1 5705148d42 Apply set_fonts/add_font right away when no font is loaded yet (#8602)
An app built without `default_fonts` starts with no font at all and
installs its own, often from inside its first pass (an `egui_kittest`
harness has no earlier hook).
Fonts used to apply at the start of the *next* pass, so that first pass
laid out every string with an empty family, which since #8601 panics
under `MissingGlyphPolicy::Panic`. Rerun's tests hit this on every
harness.

Nothing laid out before the first font arrives could have used one, so
applying immediately in that case has nothing to keep consistent. With
`default_fonts` on, nothing changes.

Regression test in `egui_kittest/tests/missing_glyphs.rs`.

Written by Claude (an LLM) for @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>
2026-09-21 14:08:43 +02:00
Emil ErnerfeldtandClaude Fable 5.1 4d831b13d2 Add Rangef::union (#8603)
Adds `Rangef::union`: the smallest range containing both ranges, the
counterpart of `intersection`.

Needed for building min/max envelopes (e.g. audio waveforms) in Rerun,
where we currently spell it out as `Rangef::new(a.min.min(b.min),
a.max.max(b.max))`.

Written with Claude Code (an LLM), reviewed by @emilk.

* [x] I have followed the instructions in the PR template

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 14:06:56 +02:00
Emil ErnerfeldtandClaude Fable 5.1 25f0cf491e Draw tofu for families without fonts, and add MissingGlyphPolicy (panics by default in egui_kittest) (#8601)
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>
2026-09-21 13:03:24 +02:00
Emil ErnerfeldtandClaude Fable 5.1 9d7fee57e0 Make Context::add_glyph_rasterizer idempotent (#8600)
`Context::add_glyph_rasterizer` appended a rasterizer and requested a
repaint on every call. Calling it from a setup path that runs each frame
piled up duplicates and kept the UI repainting forever (we hit this in
rerun's tests, where `apply_style_and_install_loaders` runs every frame
and the harness never settled).

* `GlyphRasterizer::new` now takes a mandatory `key`: adding a
rasterizer whose key is already installed is a no-op.
* `Context`/`Fonts`/`FontsImpl::add_glyph_rasterizer` only reload fonts,
clear caches and request a repaint when something actually changed.
`Fonts::add_glyph_rasterizer` returns whether it did.
* `SvgGlyph::into_rasterizer` is keyed by cluster, the web canvas
rasterizer by a fixed name.

Written by an LLM (Claude) 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>
2026-09-21 10:36:40 +00:00
Emil ErnerfeldtandClaude Fable 5.1 a92be313d4 Fail kittest tests when an input widget has no accessible name (#8589)
* 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>
2026-09-21 11:45:40 +02:00
Emil ErnerfeldtandClaude Fable 5.1 f966bfd5d5 Use Ui::unique_id for WidgetRect::parent_id (#8543)
`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>
2026-09-21 11:20:35 +02:00
Emil ErnerfeldtandClaude Fable 5.1 e303ab7e14 Add KeyboardShortcut::conflicts_with_text_editing (#8536)
Moved over from Rerun

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 10:30:38 +02:00
Emil ErnerfeldtandClaude Fable 5.1 c95e3d14c0 Add WidgetText::concat for joining differently styled RichTexts (#8538)
* [x] I have followed the instructions in the PR template

Adds `WidgetText::concat(style, parts)`, which joins several `RichText`s
into a single `WidgetText` (backed by a `LayoutJob`).

This is the easy way to get e.g. a label that is partly bold, or a label
with a small colored badge at the end, without manually building a
`LayoutJob` with `RichText::append_to`.

```rust
ui.label(WidgetText::concat(ui.style(), [
    RichText::new("Normal, "),
    RichText::new("strong, ").strong(),
    RichText::new("and small").small(),
]));
```

Extracted from Rerun's `re_ui::egui_ext`.

Written by Claude (LLM).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 06:17:41 +00:00
Makro 9fbd2bcf5e Fix burst of extra repaints before request_repaint_after deadlines (#8595) 2026-09-21 06:13:11 +00:00
Lukas Karel e44f9f60d9 Add DragValue::clip_text to hold field's width while editing (#8588)
A DragValue cannot be held to a width while it is text-edited: the
TextEdit it builds for that state hardcodes clip_text(false), so the
widget grows to fit whatever has been typed and carries its layout with
it. A long entry can stretch a containing popup off-screen. range() does
not help, since it only applies once the edit commits.

clip_text(true) forwards to that TextEdit, so the widget keeps its width
and the text scrolls inside it, following the cursor. Defaults to false,
leaving existing behavior unchanged.

Example on egui.rs:
<img width="1418" height="696" alt="20260917-1900-19 6437910"
src="https://github.com/user-attachments/assets/4bc102ad-24e9-43ae-9e81-91c17a2c2c91"
/>

* Small fix; no corresponding issue created
* [X] I have followed the instructions in the PR template
2026-09-20 07:16:22 +00:00
Emil ErnerfeldtandClaude Fable 5.1 8fb03c9ae9 Improve accessibility of popups, menus, tooltips, modals and panels (#8581)
Found while making the Rerun viewer navigable by accessible name:
floating containers were anonymous `Unknown`/`GenericContainer` nodes at
the root of the tree, and icon-only buttons with a tooltip had no name.

* `Ui`s get an accesskit role from their `UiKind`: panels are `Pane`,
modals and popups `Dialog`, menus `Menu`, tooltips `Tooltip`.
* Popups and tooltips hang under the widget that opened them
(`Area::accessibility_parent`, set through `Popup::anchor_widget`)
instead of floating at the root.
* Combo box popups are `ListBox`.
* `on_hover_text` sets the widget's accessible description, and its name
if it has none.

Drafted with Claude Code (an LLM), tests included.

* [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>
2026-09-18 11:57:45 +02:00
Emil ErnerfeldtandClaude Opus 5 89cc9481c6 Take impl AsIdSalt in the Panel constructors (#8592)
`impl Into<IdSalt>` is an anti-pattern. `impl AsIdSalt` is the correct
shape.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 09:21:03 +00:00
Emil ErnerfeldtandClaude Opus 5 7da69e484b Replace glob re-exports in egui/src/lib.rs with explicit lists (#8591)
Each `use foo::*` at the crate root is now spelled out, so it is obvious
what `egui` re-exports and where each name comes from.

In particular, `cargo doc -p egui` will now show all exported items

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 11:10:22 +02:00
Emil Ernerfeldt 6bc0a82e21 Add IdSaltSet and IdSaltMap (#8590) 2026-09-18 10:29:36 +02:00
Lucas Meurer 5931e21d1f Clarify what Id to pass in accessibility_parent (#8582) 2026-09-17 16:07:59 +02:00
Emil ErnerfeldtandClaude Opus 5 8961031123 Don't drop the fonts in the middle of a pass (#8585)
Four `Context` methods dropped the font cache immediately:

```rust
pub fn add_glyph_rasterizer(&self, glyph_rasterizer: GlyphRasterizer) {
    self.write(|ctx| {
        ctx.glyph_rasterizers.push(glyph_rasterizer);
        ctx.fonts = None;   // ← even if we are mid-pass
    });
}
```

Call any of them from inside a pass and the next text layout panics with
`No fonts available until first call to Context::run()`, or the
tessellator hits `.expect("No fonts loaded")`.

They now set a `reload_fonts` flag that `update_fonts_mut` acts on at
the start of the next pass, which is what `set_fonts` and `add_font`
already do, and each requests a repaint so the change still shows up
promptly.

Found in [Rerun](https://github.com/rerun-io/rerun): our style setup
calls `add_glyph_rasterizer` to draw a couple of glyphs from our own SVG
icons, and every `egui_kittest` test calls that setup inside its
`build_ui` closure. 592 tests on Linux and 590 on macOS died on those
two panics.

The new test fails on `main` with exactly that message and passes here.

* [x] I have followed the instructions in the PR template

Disclosure: this PR was written by Claude (an LLM).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 16:06:47 +02:00
Emil ErnerfeldtandClaude Opus 5 742d186879 Keep the AccessKit role a widget declared when its text is selectable (#8574)
`update_accesskit_for_text_widget` unconditionally called
`builder.set_role`, so the selectable-label pass overwrote the role a
widget had already reported through its `WidgetInfo`. A `Link` came out
as `Role::Label`, indistinguishable from static text to a screen reader.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 16:05:19 +02:00
Emil ErnerfeldtandClaude Opus 5 2007ec324b Bring back AsId, deprecated (#8586)
Removing `AsId` broke downstream crates that name the trait in their own
bounds or re-exports. It is back, but `#[deprecated]`

* https://github.com/emilk/egui/pull/8584

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 15:55:28 +02:00
Emil ErnerfeldtandClaude Opus 5 3690fb5b0e Remove the AsId trait (#8584)
We want to be explicit when constructing `Id`s as `Id::unique`. `AsId`
was the old implicit way. For implicit parameters, use `impl AsIdSalt`

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 12:43:49 +00:00
14a010bda7 Add RangeSlider, a two-handled slider sharing Slider's core (#8580)
* 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>
2026-09-17 14:16:58 +02:00
Emil ErnerfeldtandClaude Opus 5 523152aaa8 ⚠️ Remove default_fonts from default features (#8583)
Remove `default_fonts` from the list of default features of `egui` and
`epaint`, but keep it for `eframe`.

This is so that 3rd party egui crates don't accidentally force the
`default_fonts` feature on all upstream users.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 14:14:26 +02:00
Emil ErnerfeldtandClaude Opus 5 7ba3dbc4b0 Fix a flaky test in id::debug_format_tests (#8573)
`with_salt_matches_with` and `with_one_child` built the same `Id` by
different routes.
The debug source map keeps the first spelling it sees for an `Id` and
ignores later ones, so whichever test ran first decided what the other
one's `{:?}` printed — and the test order is not fixed.

Giving `with_salt_matches_with` sources of its own removes the shared
entry.

Surfaced by the red `Run tests` on #8571, which does not touch `id.rs`.
It reproduces on `main`: running just the two tests together, 10 of 15
runs failed before this change, and 12 runs of the whole module after it
failed none.

🤖 This PR was opened by a coding agent (Claude Opus 5).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 09:59:00 +00:00
60d7caaea3 Handle egui_inspection requests even while a window is hidden (#8571)
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>
2026-09-16 09:55:00 +00:00
Emil ErnerfeldtandClaude Fable 5.1 235f24eb9e Rename Ui::id to Ui::scope_id and clarify its docstring (#8542)
`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>
2026-09-15 19:38:48 +02:00
Lucas Meurer 9de3cfb424 Add HarnessBuilder::with_render_cursor (#8551)
Adds a setting on wheter the cursor should be rendered or not. 
Fixes the recording feature potentially rendering frames of the same
pass multiple times, which is unexpected during normal (non-test)
execution and might cause crashes in custom rendering callbacks.
2026-09-15 13:56:22 +02:00
Emil Ernerfeldt cfd0265cbf Update rustls (#8567) 2026-09-15 13:23:36 +02:00
Emil ErnerfeldtandClaude Fable 5.1 4df4cda4a3 Add Context::root_ui and Context::run_pass (#8535)
* Closes <https://github.com/emilk/egui/issues/8415>
* [x] I have followed the instructions in the PR template

Adds `Context::root_ui` to access the root `Ui` of the current pass from
anywhere, and `Context::run_pass` (like `run_ui`, but the callback gets
`&Context`). The root `Ui` is stored in the viewport state during the
pass and created on demand, so `root_ui` also works with
`begin_pass`/`end_pass`.

This lets integrations like `bevy_egui`, where ui code is spread over
many systems sharing only a `Context`, add panels again:

```rust
ctx.root_ui(|ui| {
    egui::Panel::left("left").show(ui, |ui| { /* … */ });
});
```

Panels added this way share one root `Ui`, so they stack correctly and
`Context::is_pointer_over_egui` stays correct. Calling `root_ui` while
the root `Ui` is already borrowed (e.g. inside the `run_ui` callback)
panics with a clear message.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 09:05:32 +02:00
Lucas Meurer 441971a776 Split AtomLayout into WidgetAtom and ContainerAtom (#8222)
`AtomLayout` kinda combined two seperate concerns, this logically
seperates them.

Also makes nested atoms a lot more lightweight, not requiring a
`Response`.
2026-09-11 14:06:19 +02:00
Lucas Meurer 65e7db3c06 Fix eframe web text agent being visible (#8550)
Fixes weird shapes appearing after the cursor in egui textedits:


https://github.com/user-attachments/assets/fceff925-691a-4ab3-8b2c-7a364a47edc3



- introduced in #8045
2026-09-10 16:14:37 +02:00
Emil ErnerfeldtandClaude Fable 5.1 5270bc17a2 Add CompletionPopup: a code completion popup over TextEdit (#8529)
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.


![screenshot](https://github.com/emilk/egui/raw/emilk/code-completion-example/examples/code_completion/screenshot.png)

* 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>
2026-09-10 13:43:49 +02:00
Emil ErnerfeldtandClaude Fable 5.1 24c6061a58 Allow multiple GlyphRasterizers, with priority over installed fonts (#8545)
`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>
2026-09-10 13:09:13 +02:00
Lucas Meurer 6fb77b6a21 Record egui_kittest tests as mp4s via KITTEST_RECORD=1 (#8118)
Allows you to record mp4 videos of kittest test runs.

Can produce videos like this:

<img width="500" height="300" alt="menu_close_on_click_outside"
src="https://github.com/user-attachments/assets/2497de98-16a3-4018-9d9c-16f764447e51"
/>
2026-09-10 10:53:26 +00:00
Emil ErnerfeldtandClaude Fable 5.1 e30084abf3 Add Response::container_hovered, container_clicked, container_context_menu, etc (#8537)
* [x] I have followed the instructions in the PR template

The response of a container (e.g. from `Ui::response` or
`ui.scope(…).response`) is not `hovered()` or `clicked()` when a child
widget is under the pointer, since the child covers the container.

This adds methods that treat the container and its children as one:

* `Response::container_contains_pointer`
* `Response::container_hovered`
* `Response::container_clicked`
* `Response::container_secondary_clicked`
* `Response::container_context_menu`

Useful for e.g. highlighting a table row that holds buttons, or showing
a context menu for a whole row.

Extracted from Rerun's `re_ui::egui_ext`, where it has been in use for a
while.

Written by Claude (LLM).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 12:43:01 +02:00
Lucas MeurerandClaude Opus 5 9396036534 Paint SubMenuButton arrow as a triangle instead of a glyph (#8525)
Eguis built in widgets should work right even if there are no
default/system fonts. This renders the submenubutton triangle with
epaint so it will always look right and isn't system-font dependent.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 12:08:47 +02:00
Emil ErnerfeldtandClaude Fable 5.1 e8a2c5571d Fix outdated default in TableBuilder::max_scroll_height docstring (#8544)
The default was changed to `f32::INFINITY` in #4817, but the docstring
still claimed `800.0`.

* Related: <https://github.com/emilk/egui/issues/3114>

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 16:41:16 +02:00