Commit Graph
3 Commits
Author SHA1 Message Date
b2b704282c feat(browser): flash the page viewport size while the pane resizes (#31145)
* feat(browser): flash the page viewport size while the pane resizes

Resizing the built-in browser pane gave no sign of the page's size, so
landing on a CSS breakpoint meant guessing or reading innerWidth in
DevTools. The existing zoom badge now also flashes the guest's
innerWidth × innerHeight after each resize, so zoom and size share one
corner instead of stacking. The size comes from the host box, UI zoom
and the guest's live zoom level, because a UI zoom change overwrites
the guest's zoom behind the pane's remembered level.

Refs #31014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(browser): cover no size flash on tab open and tab switch

The issue promises the size badge stays hidden when a tab opens or is
shown again, but the e2e only checked it after the 1.4s fade had
already passed, so a stray flash would go unnoticed. A renderer-side
counter now records every size flash, and the hook test covers a pane
that is hidden and shown again at a new size.

Refs #31014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(browser): cover the badge shared by zoom and size feedback

Zoom and size feedback now share one label and one fade timer, so the
latest change wins, but nothing exercised that hook directly. The new
test checks that a size flash replaces the zoom label and restarts the
fade instead of letting the earlier timer hide it early.

Refs #31014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(browser): keep the size badge exact under Chrome's zoom presets

After rebasing onto per-site zoom (#31621), zoom levels snap to Chrome
presets such as 90%, so the badge drifted a pixel from innerWidth: the
zoom factor snapped levels that UI zoom sets freely, and rounding did
not match Blink. The factor now uses the guest's level as is, and the
size mirrors Blink's AdjustForAbsoluteZoom::AdjustInt on the integer
DIP size, checked against the e2e's measured guest sizes.

Refs #31014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(browser): never show a size flash that may be wrong or stale

Before dom-ready the guest's zoom cannot be read, and a saved site zoom
lands at that moment, so sizing it at the default zoom could flash a
wrong number. A flash left running when the page went inactive or was
parked at 0×0 could also come back stale, since nothing measures it
then. Both cases now skip or hide the flash, because no size is better
than a misleading one.

Refs #31014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(browser): announce the first resize after a tab opens

Skipping measurements until the guest zoom is readable also dropped the
baseline, and a new tab's opening measurement usually arrives before
dom-ready, so the first resize afterwards only set a baseline and never
showed the badge. The baseline is now kept as the host box size and
converted at the zoom readable when the next measurement comes, so no
zoom is guessed and the first real resize is still announced.

Refs #31014

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(browser): drop the size format case that only copied the string

The case asserted that the label reads exactly `1024 × 768`, which
restates the format string rather than any behavior, and main now
treats such copied-string tests as low value (#33736, #33778).

Refs #31014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(browser): fold the size readout into its hook and drop tests that don't prove it

Moves the guest-size conversion into the hook that uses it, inlines the
one-use label formatter and predicate, and drops the e2e spec, the badge
timer test and the predicate tests. The conversion keeps its test against
sizes measured from a real guest.

* fix(browser): keep the size flash off under viewport presets and out of the pane's render

A preset pins the page size, and mobile emulation's layout viewport can
differ from the host box, so the readout only runs on a free-sized pane.
The badge now owns its label and fade state behind a ref handle, so a
resize drag re-renders only the badge instead of the whole page pane.

* fix(browser): skip the size flash while a phone or remote viewer sets the page metrics

* fix(browser): fold the screen scale into the size readout's rounding

Blink rounds the guest viewport in device pixels with the screen scale
times page zoom as its factor, so ignoring the screen scale left the
badge 1px off at most non-100% zoom levels on 2x screens.

* fix(browser): port Blink's exact zoom rounding to the size readout

Chromium 150's AdjustForAbsoluteZoom::AdjustInt adds 0.5 in float math
before dividing when zoomed in and truncates with a 0.01 slack, so the
+1 rule showed the badge 1px wide at many zoomed-in sizes.

* fix(browser): size the readout's guest frame in whole DIPs before the screen scale

Chromium rounds a guest frame to whole DIPs and only then scales it to
device pixels, so a fractional split width read one device pixel short.

* fix(browser): round the readout's guest frame up to whole DIPs

A live sweep at 1.2 UI zoom on a 2x screen showed Chromium sizes the
guest frame as the ceiling of the box in DIPs, not the nearest DIP.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com>
2026-10-29 21:14:33 +00:00
7c05c8c72e fix(repo-icon): center emoji glyph within its sized icon box (#12057)
* fix(repo-icon): center emoji glyph within its sized icon box

The emoji glyph span in RepoIconGlyph received a fixed-size box via
iconClassName but had no self-centering, so the outer flex only
centered the box itself while the glyph sat top-left inside it —
most visible in the settings preview (size-10 box, size-5 icon).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ewCWxSox2WHN8T78AT7T4

* test(repo-icon): cover emoji centering in its sized icon box

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-08-09 16:35:39 -07:00
외계공룡andchucoding dc0cb1806a feat(repo-icon): expand the project emoji picker (#7989) (#12058)
Replace the hardcoded 12-emoji grid in the repo icon settings with the full searchable, category-navigable emoji picker, reusing the existing emoji-picker-react dependency in a lazily-loaded chunk.

Every pick is re-validated through sanitizeRepoIcon, so an over-cap ZWJ/skin-tone sequence surfaces a toast instead of silently no-op'ing. Skin tones stay selectable.

Maintainer follow-up: use lazyWithRetry so a failed chunk cannot permanently blank the Settings page, disable autoFocusSearch on this inline picker, scope font-family to descendants (the library sets sans-serif on every child), cover the uncovered dark-mode picker variables, match the app scrollbar, and assert the result in the DOM per tests/e2e/AGENTS.md.

New strings are translated in es/ja/ko/zh.

Co-authored-by: chucoding <chucoding@users.noreply.github.com>
2026-08-03 23:00:02 -07:00