Files
initiative/specs/020-fix-zero-hp-opacity/spec.md

83 lines
5.8 KiB
Markdown

# Feature Specification: Fix Zero-HP Opacity
**Feature Branch**: `020-fix-zero-hp-opacity`
**Created**: 2026-03-06
**Status**: Draft
**Input**: User description: "There is a bug in the system. When a creature is at 0 HP the popout menu for health delta and the condition dropdown are shown transparent. The user expects to still use the menus like they would be used for any other creature with an amount of hitpoints > 0."
## User Scenarios & Testing *(mandatory)*
### User Story 1 - Adjust HP on an Unconscious Combatant (Priority: P1)
A game master clicks on the HP area of a combatant at 0 HP to open the health-delta popout menu. The popout appears at full opacity and is fully interactive, just like it would for any combatant with HP above zero. The GM can enter a healing value or further damage without any visual impairment.
**Why this priority**: This is the core bug. Without being able to interact with the HP popout at full visibility, the GM cannot heal unconscious creatures or apply further damage, which are critical gameplay actions.
**Independent Test**: Can be fully tested by reducing a combatant to 0 HP, opening the HP-delta popout, and verifying it renders at full opacity and accepts input normally.
**Acceptance Scenarios**:
1. **Given** a combatant is at 0 HP (unconscious), **When** the user opens the health-delta popout, **Then** the popout menu renders at full opacity (not dimmed/transparent).
2. **Given** a combatant is at 0 HP (unconscious), **When** the user enters a positive HP delta in the popout, **Then** the healing is applied identically to how it works for combatants above 0 HP.
3. **Given** a combatant is at 0 HP (unconscious), **When** the user enters a negative HP delta in the popout, **Then** the damage is applied identically to how it works for combatants above 0 HP.
---
### User Story 2 - Manage Conditions on an Unconscious Combatant (Priority: P1)
A game master clicks the conditions area of a combatant at 0 HP to open the condition-picker dropdown. The dropdown appears at full opacity and is fully interactive, allowing the GM to add or remove conditions on the unconscious creature.
**Why this priority**: Conditions are frequently relevant for unconscious creatures (e.g., adding Prone, removing Poisoned). The dropdown must be usable regardless of HP status.
**Independent Test**: Can be fully tested by reducing a combatant to 0 HP, opening the condition dropdown, and verifying it renders at full opacity and toggles conditions normally.
**Acceptance Scenarios**:
1. **Given** a combatant is at 0 HP (unconscious), **When** the user opens the condition dropdown, **Then** the dropdown renders at full opacity (not dimmed/transparent).
2. **Given** a combatant is at 0 HP (unconscious), **When** the user toggles a condition in the dropdown, **Then** the condition is applied or removed identically to how it works for combatants above 0 HP.
---
### User Story 3 - Row Still Visually Indicates Unconscious State (Priority: P2)
While the popout menus and dropdowns must be fully opaque, the combatant row itself should still visually communicate that the creature is at 0 HP / unconscious. The visual distinction should not be lost entirely; it should just not affect interactive overlays.
**Why this priority**: Preserving the unconscious visual indicator is important for at-a-glance status recognition, but it must not compromise usability of interactive elements.
**Independent Test**: Can be tested by verifying that an unconscious combatant row still looks visually distinct from healthy combatants while its popouts render at full opacity.
**Acceptance Scenarios**:
1. **Given** a combatant is at 0 HP, **When** the user views the encounter list, **Then** the combatant row still has a visual indicator that distinguishes it from combatants above 0 HP.
2. **Given** a combatant is at 0 HP, **When** the user opens any popout or dropdown on that row, **Then** the popout/dropdown itself is not affected by the unconscious visual styling.
---
### Edge Cases
- What happens when a combatant is healed from 0 HP while the popout is open? The row should transition to normal styling smoothly; the open popout should remain functional.
- What happens when a combatant drops to 0 HP while the popout is open? The row should transition to unconscious styling; the open popout should remain at full opacity and functional.
## Requirements *(mandatory)*
### Functional Requirements
- **FR-001**: System MUST render the health-delta popout menu at full opacity for combatants at 0 HP.
- **FR-002**: System MUST render the condition-picker dropdown at full opacity for combatants at 0 HP.
- **FR-003**: System MUST keep all popout/dropdown interactions (input, toggle, dismiss) fully functional for combatants at 0 HP, identical to combatants above 0 HP.
- **FR-004**: System MUST still visually distinguish unconscious combatants (0 HP) from conscious ones in the row itself, without affecting overlay elements.
## Success Criteria *(mandatory)*
### Measurable Outcomes
- **SC-001**: All popout menus and dropdowns for 0-HP combatants render at 100% opacity (visually identical to those on combatants above 0 HP).
- **SC-002**: Users can complete HP adjustment and condition management workflows on 0-HP combatants without any additional steps or difficulty compared to other combatants.
- **SC-003**: Unconscious combatants remain visually distinguishable from conscious combatants in the encounter list.
## Assumptions
- The root cause is a CSS opacity rule applied to the entire combatant row container when a combatant is unconscious, which cascades to child elements including popouts and dropdowns.
- The fix involves scoping the unconscious visual styling so it does not affect overlay elements (popouts, dropdowns) that are rendered as children of the row.
- No domain or application layer changes are needed; this is a purely visual/adapter-layer fix.