fix: handle hover styling for field containers

This commit is contained in:
Lucas Smith
2026-06-22 16:14:04 +10:00
parent e2754ac314
commit ffbfdbf735
5 changed files with 140 additions and 58 deletions
@@ -5,6 +5,18 @@ export const FIELD_ROOT_CONTAINER_CLASS_NAME = `${FIELD_ROOT_CONTAINER_SHARED_CL
export const FIELD_ROOT_CONTAINER_PROBE_CLASS_NAME = `field--FieldRootContainerProbe ${FIELD_ROOT_CONTAINER_SHARED_CLASS_NAME}`;
/**
* Class embedders target to style a field's hover state, e.g.
* `.field--FieldRootContainerHover { background-color: ... }`.
*
* Canvas-rendered fields can't use the `:hover` pseudo-class (there's no real
* DOM element to hover), so the hover probe applies this class permanently to
* read the hovered cascade synchronously via `getComputedStyle`. Using a real
* class instead of `:hover` keeps resolution deterministic — no stylesheet
* parsing, pseudo-class synthesis, or source-order/specificity guesswork.
*/
export const FIELD_ROOT_CONTAINER_HOVER_CLASS_NAME = 'field--FieldRootContainerHover';
/**
* Selector for the element the probe is appended into when reading computed
* field styles. It must be an ancestor of where real fields render so the probe