Skip to content

explorer: Line up cards, rows and tooltips, and keep large amounts exact - #341

Merged
HDauven merged 5 commits into
mainfrom
fix/alignment
Nov 24, 2026
Merged

HDauven merged 5 commits into
mainfrom
fix/alignment

Conversation

@HDauven

@HDauven HDauven commented Nov 22, 2026

Copy link
Copy Markdown
Member

What changed

  • Amounts past 2^53 LUX stay exact. The node writes u64s as bare JSON numbers, and a JavaScript number holds an integer exactly only up to 9,007,199.254740991 DUSK, so the two largest stakes on mainnet showed as 14,927,768.807078792 and 13,102,790.940789548 DUSK in their exact tooltips. The node's answers are now read with parseJson (src/lib/dusk/json), which gives such an integer as a bigint of every digit written. It uses only JSON.parse with a reviver and BigInt, since JSON.parse's source text access isn't in every browser the build supports. Fees, stake totals and stake and reward order are worked out exactly; the raw payload and header show the numbers as the node wrote them. An answer with no run of 16 digits, which no integer past 2^53 can have, goes straight to JSON.parse: 40 ms against 18 ms native for 10 MB; one with such a run takes the slower path (about 0.4 s for 10 MB, against small answers in practice). Node info stays plain JSON: it holds u64::MAX heights, is never shown, and is compared as JSON text.
  • Layout:
    • Phone transaction rows keep the sender and the receiver whole: the receiver, with its arrow, goes to the next line when both don't fit, where it was cut to a letter or lost.
    • The home page's cards share their rows with subgrid, so numbers side by side line up, and a note longer than its card wraps inside it.
    • The provisioners table fits the page from 1024 px, and a sorted column's label stays over its numbers.
    • A tooltip is never narrower than the largest amount of DUSK, so an exact amount stays on one line, and its arrow follows it when it is moved to stay in the window.
    • Button labels show their descenders, a switch's knob stays in its track, and the footer stays at the window's foot after a search that finds nothing.
  • Tooltip descriptions: the tooltip set aria-described-by, which nothing reads. It now sets aria-describedby, and leaves a control's own description alone.
  • Map: places were keyed by their coordinates, so two places at one point threw each_key_duplicate and blanked most of the home page's numbers. Each place is now its own key.

How it was checked

  • New tests fail on main and pass here. They read raw response text with 14927768807078791, 13102790940789547, 2^53+1 and u64 max, and check the shown values on the provisioners table and cards, the balance, ranks and sorting, stake totals, the transaction and block pages with their raw views, and the lists. There are also tests for parseJson, the map with two places at one point, and the tooltip's accessible description.
  • Every CI step passes: release ages, npm audit signatures, format, lint, typecheck, 415 tests and the build.
  • Real builds of main and this branch were compared in Chromium, Firefox and WebKit at 320, 360, 390, 768, 1025 and 1280 px against captured mainnet answers and stress amounts, measuring each fix, with an alignment probe over every screen a change touches. German and French locales and the dark theme were checked too.
  • At 320 px, a row with an amount of 14 characters or more still leaves the receiver's line about 9 px short, so its address ends early with an ellipsis. Before, the receiver vanished.

The node writes its u64s as bare JSON numbers, and a JavaScript number
holds an integer exactly only up to 2^53 LUX, 9,007,199.254740991 DUSK.
Past it, amounts shown as exact lost their last digits: the two largest
stakes on mainnet showed as 14,927,768.807078792 and 13,102,790.940789548
DUSK.

The node's answers are read with parseJson, which gives an integer past
2^53 as a bigint of every digit it was written with. JSON.parse's source
text access would do it, but not in every browser the build supports.
Fees, the stakes' totals and their order are worked out exactly, and the
raw payload and header are shown as the node wrote them. Rounded figures
stay numbers.
- A phone's transaction row keeps its sender and receiver whole: the
  receiver, with its arrow, goes to the next line when both don't fit,
  where it was cut to a letter, or lost with its arrow.
- The home page's cards share their rows with subgrid, so a label on
  two lines no longer pushes its number below the one beside it, and a
  line under a number that is longer than its card wraps inside it.
- Narrower than 1280 px, the line under a provisioner's stake breaks
  between its parts, so the table fits the page; a sort's arrow hangs
  after its label, which stays over its numbers.
- A tooltip is never narrower than the largest amount of DUSK, so an
  exact amount no longer breaks in two, and its arrow moves back as far
  as the tooltip was moved to stay in the window.
- A button's label shows its descenders, a switch's knob is a block that
  text alignment can't move out of its track, and the footer stays at
  the window's foot when a search that found nothing hides the page.
The tooltip set aria-described-by, which nothing reads, so screen readers
never heard it. It now sets aria-describedby while it shows, and takes
off only its own: a control that describes itself, as a row's help does,
keeps its description.
The map keyed each place by its coordinates, but places are grouped by
city and country, and IP lookups can put two of them at one point. Two
such places made Svelte throw each_key_duplicate, and the home page
showed most of its numbers as dashes. Each place is now its own key.
@HDauven
HDauven merged commit e1c765c into main Nov 24, 2026
1 check passed
@HDauven
HDauven deleted the fix/alignment branch November 24, 2026 01:37
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