You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2026/08/29 20:56:40 UTC
(causeway) 01/06: docs(openspec): propose description tooltip presentation
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch htmx
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 92dd6701646307bbaebecee8ef9f1d2128067fff
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Aug 29 18:48:20 2026 +0200
docs(openspec): propose description tooltip presentation
---
.../.openspec.yaml | 2 +
.../add-description-tooltip-presentation/design.md | 82 +++++++++++
.../proposal.md | 29 ++++
.../specs/domain-web-components/spec.md | 160 +++++++++++++++++++++
.../add-description-tooltip-presentation/tasks.md | 17 +++
5 files changed, 290 insertions(+)
diff --git a/openspec/changes/add-description-tooltip-presentation/.openspec.yaml b/openspec/changes/add-description-tooltip-presentation/.openspec.yaml
new file mode 100644
index 00000000000..50adc91034f
--- /dev/null
+++ b/openspec/changes/add-description-tooltip-presentation/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-08-29
diff --git a/openspec/changes/add-description-tooltip-presentation/design.md b/openspec/changes/add-description-tooltip-presentation/design.md
new file mode 100644
index 00000000000..d9ecd425954
--- /dev/null
+++ b/openspec/changes/add-description-tooltip-presentation/design.md
@@ -0,0 +1,82 @@
+## Context
+
+`<cw-property>` currently renders an effective description inline and also gives its visible label a native `title`, while a disabled reason uses a bounded custom tooltip on that label.
+`<cw-collection>` renders its effective description inline beneath the heading and intentionally suppresses the collection-level disabled reason.
+Actions already keep descriptions out of normal layout and preserve their own accessible explanation, so this change is limited to properties and collections.
+
+The component library uses light-DOM markup, semantic IDs and ARIA relationships, and mirrored `component-styles.css` and `component-styles.mjs` assets.
+Any tooltip behavior must remain framework-neutral, keyboard reachable, escaped, bounded, responsive, and independent of GraphQL loading.
+
+## Goals / Non-Goals
+
+**Goals:**
+
+- Let authored property and collection markup select visible-label or tooltip description presentation.
+- Preserve visible descriptions as the default for backward compatibility.
+- Present description and disabled reason as ordered, visually distinct tooltip sections when both exist.
+- Preserve independent accessible description and disabled-reason semantics.
+- React to attribute changes without reloading member data.
+
+**Non-Goals:**
+
+- Changing action description behavior.
+- Adding GraphQL fields or changing metadata precedence.
+- Introducing a third-party tooltip dependency or modifying toolkit internals.
+- Making disabled collections editable or changing member/action authorization.
+
+## Decisions
+
+### Use one authored `description-as` attribute with a conservative fallback
+
+Both components will observe `description-as`.
+Values are normalized case-insensitively to `label` or `tooltip`; absent, blank, and unsupported values resolve to `label`.
+This keeps all existing pages unchanged and avoids an unknown presentation state.
+
+### Keep semantic text separate from visual tooltip payload
+
+The effective description and disabled reason remain separate escaped DOM nodes with stable IDs so `aria-describedby` exposes them independently and in description-then-reason order.
+In `label` mode the description node remains visible.
+In `tooltip` mode it becomes visually hidden rather than being removed.
+
+A shared tooltip trigger carries a bounded escaped visual payload.
+When both texts exist, the payload places the description first and the disabled reason second with an explicit section break.
+The styling preserves that break and provides one consistent pointer and focus presentation for both components.
+
+This is preferred over relying only on `title`, which is not reliably keyboard accessible and cannot present structured sections consistently.
+
+### Anchor tooltips to the semantic name
+
+A property with a visible label uses that label as the trigger.
+A collection uses its heading as the trigger.
+A tooltip trigger is focusable only when tooltip content exists.
+For `label-position="NONE"`, the property field shell becomes the visible/focusable tooltip trigger while the hidden label continues to provide the accessible name.
+
+This avoids an unreachable tooltip while preserving explicit label suppression.
+
+### Bound each source before composition
+
+Description and disabled-reason text are trimmed and bounded independently before creating the visual payload.
+The tooltip never renders raw HTML and does not expose stale data after rerender.
+Independent bounds prevent one section from consuming the entire diagnostic budget.
+
+### Preserve collection read-only semantics while restoring explanation on demand
+
+A collection-level disabled reason remains absent from normal page layout.
+It is exposed only through the heading tooltip and accessible hidden text.
+Rows, paging, associated actions, and their own authorization remain unchanged.
+
+## Risks / Trade-offs
+
+- [Risk] Adding a focus stop to headings or property fields can increase keyboard traversal.
+ → Mitigation: add focusability only when a tooltip has content and test both tooltip and default modes.
+- [Risk] Pseudo-element tooltip text has limited rich structure.
+ → Mitigation: use a preserved section break for visual grouping and separate ARIA description nodes for semantic grouping.
+- [Risk] Mirrored stylesheet assets can drift.
+ → Mitigation: update both assets together and retain parity regression tests.
+- [Risk] Long metadata could produce oversized overlays.
+ → Mitigation: bound each section and cap tooltip width to the viewport.
+
+## Migration Plan
+
+No markup migration is required because omitted and invalid values retain visible-label presentation.
+Applications can opt in incrementally with `description-as="tooltip"` and can opt back out with `description-as="label"` or by removing the attribute.
diff --git a/openspec/changes/add-description-tooltip-presentation/proposal.md b/openspec/changes/add-description-tooltip-presentation/proposal.md
new file mode 100644
index 00000000000..c5654c7a634
--- /dev/null
+++ b/openspec/changes/add-description-tooltip-presentation/proposal.md
@@ -0,0 +1,29 @@
+## Why
+
+Visible property and collection descriptions consume scarce page space even when users only need them occasionally.
+Authors need a compact presentation option that preserves accessible descriptions and still explains disabled members without changing the established action-tooltip contract.
+
+## What Changes
+
+- Add a `description-as` attribute to `<cw-property>` and `<cw-collection>` with supported `label` and `tooltip` values.
+- Preserve the existing visible description presentation as the default and as the explicit `label` mode.
+- In `tooltip` mode, remove the description from visible layout while exposing it from the property label or collection heading by pointer and keyboard.
+- Compose a disabled reason beneath the description as a distinct tooltip section when a property or collection is disabled.
+- Keep description and disabled-reason text available to assistive technology independently of visual presentation.
+- Leave `<cw-action>` behavior unchanged because action descriptions already use their tooltip-oriented presentation.
+- Document and test precedence, invalid-value fallback, reactivity, accessibility, bounded tooltip content, and disabled-state composition.
+
+## Capabilities
+
+### New Capabilities
+
+None.
+
+### Modified Capabilities
+
+- `domain-web-components`: Add authored description presentation modes and accessible combined description/disabled-reason tooltips for properties and collections.
+
+## Impact
+
+The change affects the framework-neutral property and collection elements, shared component styling, generated stylesheet parity, usage documentation, and foundation component/style tests.
+It does not change GraphQL selections, domain metadata, action presentation, toolkit internals, or application routing.
diff --git a/openspec/changes/add-description-tooltip-presentation/specs/domain-web-components/spec.md b/openspec/changes/add-description-tooltip-presentation/specs/domain-web-components/spec.md
new file mode 100644
index 00000000000..06fba0c5e6f
--- /dev/null
+++ b/openspec/changes/add-description-tooltip-presentation/specs/domain-web-components/spec.md
@@ -0,0 +1,160 @@
+## ADDED Requirements
+
+### Requirement: Shared member description tooltip presentation
+`<cw-property>` and `<cw-collection>` SHALL provide a framework-neutral tooltip presentation for effective descriptions without changing their metadata source or precedence.
+Tooltip content MUST be escaped, bounded, pointer-discoverable, keyboard-reachable, responsive, and associated with its member through accessible description semantics.
+
+#### Scenario: Tooltip mode is selected
+- **WHEN** a property or collection with a non-blank effective description declares `description-as="tooltip"` ignoring case
+- **THEN** the description does not consume visible layout space
+- **AND** the semantic property label, property field when its label is suppressed, or collection heading exposes the description by pointer and keyboard
+- **AND** assistive technology retains access to the effective description
+
+#### Scenario: Label mode is selected or implied
+- **WHEN** `description-as` is absent, blank, `label`, or unsupported
+- **THEN** the effective description retains the established visible label-adjacent presentation
+- **AND** unsupported input does not create an unknown presentation state
+
+#### Scenario: Description and disabled reason share a tooltip
+- **WHEN** a property or collection has both an effective description and a disabled reason
+- **THEN** one tooltip presents a bounded description section above a distinct bounded disabled-reason section
+- **AND** accessible description references preserve the same description-then-reason order
+
+#### Scenario: Only a disabled reason is available
+- **WHEN** a disabled property or collection has no effective non-redundant description
+- **THEN** its semantic tooltip trigger exposes the bounded disabled reason without an empty description section
+- **AND** the reason is not added as ordinary visible page text
+
+#### Scenario: Presentation attribute changes
+- **WHEN** `description-as` changes while the component is connected
+- **THEN** the current member rerenders using the newly resolved presentation
+- **AND** member data is not independently reloaded solely for the presentation change
+
+## MODIFIED Requirements
+
+### Requirement: Authored property presentation overrides
+`<cw-property>` SHALL support `named`, `described-as`, `description-as`, `multi-line`, and `label-position` attributes as explicit overrides of canonical property presentation metadata or its presentation.
+Canonical authored attributes MUST take precedence over compatibility aliases, which MUST take precedence over metadata and fallback values.
+
+#### Scenario: Property name is overridden
+- **WHEN** authored HTML contains `<cw-property id="firstName" named="Given name">`
+- **THEN** the visible and accessible property name is `Given name`
+- **AND** another property without `named` continues to use canonical metadata or its humanized member ID
+
+#### Scenario: Property description is overridden
+- **WHEN** authored HTML contains `<cw-property id="firstName" described-as="The given or first name of this customer">`
+- **THEN** that text is the property's effective visible or tooltip description according to `description-as`
+- **AND** it takes precedence over any canonical property description
+
+#### Scenario: Description presentation is overridden
+- **WHEN** authored HTML contains `<cw-property id="firstName" description-as="tooltip">`
+- **THEN** the effective description uses tooltip presentation regardless of whether its text came from `described-as` or canonical metadata
+- **AND** changing presentation does not change description-text precedence
+
+#### Scenario: Multiline rows are overridden
+- **WHEN** authored HTML contains `<cw-property id="notes" multi-line="5">`
+- **THEN** a supported string view or editor uses five multiline rows
+- **AND** canonical metadata does not replace the authored row count
+
+#### Scenario: Invalid multiline override
+- **WHEN** `multi-line` is malformed, no greater than one, or exceeds the supported maximum
+- **THEN** the component ignores the malformed or non-multiline value or caps an excessive value at the supported maximum
+- **AND** unrelated property rendering remains available
+
+#### Scenario: Label position is overridden
+- **WHEN** authored HTML contains `<cw-property id="firstName" label-position="TOP">`
+- **THEN** the property uses the `TOP` presentation regardless of its canonical label-position facet
+
+#### Scenario: Invalid label-position override
+- **WHEN** an authored `label-position` is not `LEFT`, `TOP`, or `NONE` ignoring case
+- **THEN** the component falls back to canonical metadata and then `LEFT`
+- **AND** exposes no broken or unknown layout mode
+
+#### Scenario: Compatibility aliases remain usable
+- **WHEN** existing markup uses `label` or `multiline`
+- **THEN** the component preserves the established override behavior
+- **AND** a simultaneously supplied canonical `named` or `multi-line` attribute wins deterministically
+
+### Requirement: Property label-position presentation
+`<cw-property>` SHALL honour the effective property label position `LEFT`, `TOP`, or `NONE` in view, loading, error, disabled, and edit states.
+Properties using `LEFT` in the same field-set-like container MUST use a consistent configurable label-to-field ratio.
+Effective multiline presentation from canonical HTML, compatibility HTML, or member metadata MUST drive the same explicit responsive shell layout.
+Description layout MUST follow the effective `description-as` mode without weakening accessible naming or description.
+
+#### Scenario: Label is positioned left
+- **WHEN** the effective label position is `LEFT`
+- **THEN** the visible label is placed to the left of the property field using the container's consistent label-column ratio
+- **AND** a label-presented description appears in smaller text below the label
+- **AND** the field uses the remaining width
+
+#### Scenario: Label is positioned top
+- **WHEN** the effective label position is `TOP`
+- **THEN** the visible label is placed above the property field
+- **AND** a label-presented description appears in smaller text below the label
+- **AND** the field uses the full available width
+
+#### Scenario: Label is suppressed
+- **WHEN** the effective label position is `NONE`
+- **THEN** no visible label or label-presented description is rendered
+- **AND** the field uses the full available width
+- **AND** interactive controls retain a meaningful accessible name
+- **AND** a tooltip-presented description remains available from the property field by pointer and keyboard
+
+#### Scenario: Property description comes from the facet
+- **WHEN** `@PropertyLayout(describedAs)` supplies a non-redundant description and no HTML text override is present
+- **THEN** the description appears in smaller text immediately below the visible label by default or in the tooltip when selected
+- **AND** the value or editor is associated with it through accessible description semantics
+
+#### Scenario: Narrow presentation stacks safely
+- **WHEN** a multiline `LEFT` property resolved from `multi-line`, legacy `multiline`, or `metadata.multiLine` cannot retain its configured columns at a narrow inline size
+- **THEN** label and any label-presented description occupy explicit successive rows followed by an explicit full-width field row in meaningful document order
+- **AND** the field's value and bounded edit control align at the start of that row without overlap or implicit-grid displacement
+- **AND** the property introduces no horizontal overflow or clipping
+
+### Requirement: Semantic collection headings
+The `<cw-collection>` component SHALL render one semantic collection heading from an explicit HTML name, canonical member metadata, or a safe member-id fallback.
+It SHALL render or tooltip-present a distinct available description according to `description-as` and associate the description with every collection presentation state.
+
+#### Scenario: HTML supplies text and presentation overrides
+- **WHEN** a collection declares non-blank `named` and `described-as` attributes and a supported `description-as` value
+- **THEN** those text values are the effective collection name and description
+- **AND** they override canonical friendly-name and description metadata
+- **AND** the description uses the selected visible-label or tooltip presentation
+
+#### Scenario: Canonical metadata supplies heading text
+- **WHEN** no applicable HTML text override exists and the collection response supplies canonical `metadata.friendlyName` or `metadata.description`
+- **THEN** each available value is used independently
+- **AND** a missing value falls back to a humanized member id for the name or no description for the description
+
+#### Scenario: Legacy label remains present
+- **WHEN** a collection declares the existing `label` attribute without `named`
+- **THEN** the label remains the effective name for backward compatibility
+- **AND** `named` takes precedence when both are non-blank
+
+#### Scenario: Description duplicates resolved name
+- **WHEN** the candidate description equals the resolved name after trimming and case-insensitive comparison
+- **THEN** no duplicate description is rendered, tooltip-presented, or referenced
+
+#### Scenario: Heading attributes change
+- **WHEN** `named`, `described-as`, `description-as`, `label`, or the member id changes while the component is connected
+- **THEN** the current collection shell rerenders with the newly resolved accessible heading and description presentation
+- **AND** collection data is not independently reloaded solely for the text or presentation change
+
+### Requirement: Quiet read-only collection presentation
+Collection wrappers SHALL remain read-only and authorization-aware without rendering their disabled or unmodifiable boolean or reason as ordinary visible explanatory text or a label.
+A non-blank collection-level reason MUST remain available on demand from the semantic heading tooltip and through accessible description semantics.
+
+#### Scenario: Mixed-in collection is unmodifiable
+- **WHEN** a readable mixed-in collection reports a disabled reason such as “Cannot edit a mixed-in collection”
+- **THEN** its rows, heading, description, paging, and applicable associated actions remain available
+- **AND** the collection-level reason is absent from ordinary visible layout but available from the heading tooltip
+
+#### Scenario: Collection has description and unmodifiable reason
+- **WHEN** a collection has both an effective description and a disabled or unmodifiable reason
+- **THEN** the heading tooltip presents the description above the reason as distinct sections
+- **AND** the description remains visibly rendered as well when `description-as` resolves to `label`
+
+#### Scenario: Member or associated action is disabled
+- **WHEN** an individual row member or associated action has its own disabled state and reason
+- **THEN** that control retains its established semantic state and explanation
+- **AND** collection-level tooltip presentation does not broaden authorization or enable mutation
diff --git a/openspec/changes/add-description-tooltip-presentation/tasks.md b/openspec/changes/add-description-tooltip-presentation/tasks.md
new file mode 100644
index 00000000000..f344698f8d6
--- /dev/null
+++ b/openspec/changes/add-description-tooltip-presentation/tasks.md
@@ -0,0 +1,17 @@
+## 1. Shared tooltip presentation
+
+- [ ] 1.1 Add normalized `description-as` resolution, bounded section composition, escaped tooltip attributes, and accessible hidden text for member descriptions and disabled reasons.
+- [ ] 1.2 Add shared pointer, keyboard, responsive, and section-break styling while keeping CSS and ECMAScript stylesheet assets synchronized.
+
+## 2. Property and collection behavior
+
+- [ ] 2.1 Update `<cw-property>` rendering across loading, error, ready, disabled, and edit states, including `label-position="NONE"` tooltip anchoring and reactive attribute changes.
+- [ ] 2.2 Update `<cw-collection>` shells and Grid accessibility across loading, error, inactive, empty, native, and toolkit states, including collection disabled reasons and reactive attribute changes.
+- [ ] 2.3 Preserve existing action presentation and member/action authorization behavior.
+
+## 3. Documentation and tests
+
+- [ ] 3.1 Document property and collection `description-as="label|tooltip"` usage, fallback behavior, and combined disabled tooltip sections.
+- [ ] 3.2 Add component tests for defaults, supported and invalid values, metadata and HTML descriptions, duplicate suppression, disabled composition, escaping, bounds, accessibility, label suppression, state coverage, and reactivity.
+- [ ] 3.3 Add stylesheet regression tests for tooltip trigger parity, pointer/focus behavior, section breaks, responsive bounds, and absence of action regressions.
+- [ ] 3.4 Run foundation tests, Maven verification, RAT, strict OpenSpec validation, diff checks, and IntelliJ compilation or inspections for changed source files.