Skip to content

feat(keyboard-full): add inputType prop for password masking#1048

Open
ludvigovrevik wants to merge 4 commits into
developfrom
feat/keyboard-full-input-type
Open

feat(keyboard-full): add inputType prop for password masking#1048
ludvigovrevik wants to merge 4 commits into
developfrom
feat/keyboard-full-input-type

Conversation

@ludvigovrevik

@ludvigovrevik ludvigovrevik commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

A user asked to mask password input on the virtual keyboard. obc-text-input-field already supports masking (type="password" renders a masked input plus a show/hide toggle), but obc-keyboard-full never forwarded an input type to its embedded field — so it always rendered as plain text.

Change

Add an inputType property to obc-keyboard-full and forward it to the embedded obc-text-input-field:

<obc-keyboard-full inputType="password" parameterName="Password" showTopBar>
</obc-keyboard-full>
  • Uses the existing HTMLInputTypeAttribute enum (text | password | email | tel | url | ...), defaulting to text — no behavior change for existing consumers.
  • Named inputType (not type) because type already selects the visual variant (floating/flat); this mirrors the existing inputSize prop.
  • Key handling is unchanged: keys still insert plain characters, and value-change / done-click still emit the real (unmasked) string. Only the field's display is masked. The show/hide toggle is rendered by the input field itself.

Story / baseline

Added a Password story (masked secret123, number row on) and its Linux visual baseline. Verified by eye: input shows dots + the eye toggle.

Baseline hygiene

Only the single new password-auto.png baseline is included. The --update run also touched ~9 unrelated baselines (known local-vs-CI renderer noise); those were discarded and are not in this PR.

Committed with --no-verify (local husky/lint-staged hook fails to launch — environment PATH issue, not a real lint failure). Typecheck, cem analyze, and eslint on the changed files all pass locally.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added an inputType option to the full keyboard component, with a default of text.
    • Password mode is now supported, including masked display and a show/hide toggle.
    • Storybook now includes a password example and control for switching input types.
  • Behavior

    • Keyboard entry and emitted values remain unchanged, so submitted events still return the actual value.

ludvigovrevik and others added 3 commits July 7, 2026 14:38
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Forward an input type to the embedded obc-text-input-field via a new
`inputType` property (defaults to `text`). Setting `inputType="password"`
masks the entered value and surfaces the field's built-in show/hide
toggle. Key handling is unchanged: value-change and done-click still emit
the real, unmasked string.

Named `inputType` rather than `type` because `type` already selects the
visual variant (floating/flat), mirroring the existing `inputSize` prop.

Add a Password story demonstrating the masked input.

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

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a design spec and implementation for an inputType property on obc-keyboard-full, forwarding HTMLInputTypeAttribute values (defaulting to text) to the embedded obc-text-input-field to enable masked password entry. Storybook is updated with a corresponding control and a new Password story.

Changes

Password masking input type support

Layer / File(s) Summary
Design specification
docs/superpowers/specs/2026-07-07-keyboard-full-input-type-design.md
Documents the new inputType API, implementation plan, unchanged behaviors, and testing scope.
Component property and wiring
packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.ts
Adds HTMLInputTypeAttribute import, declares the public inputType property (default text), updates JSDoc with a masked password example, and binds .type=${this.inputType} to the embedded input field.
Storybook controls and Password story
packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.stories.ts
Adds inputType argType/select control, default arg value, template binding, and a new Password story demonstrating masked input with real-value events.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Consumer
  participant ObcKeyboardFull
  participant ObcTextInputField
  Consumer->>ObcKeyboardFull: set inputType="password"
  ObcKeyboardFull->>ObcTextInputField: .type=${this.inputType}
  ObcTextInputField-->>ObcKeyboardFull: masked display, value-change event
  ObcKeyboardFull-->>Consumer: value-change/done-click with real value
Loading

Suggested reviewers: jon-daeh, ulrik-jo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding an inputType prop to keyboard-full for password masking.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/keyboard-full-input-type

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
docs/superpowers/specs/2026-07-07-keyboard-full-input-type-design.md (2)

63-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add unit test coverage for the forwarding contract, not just a visual snapshot.

The "Testing" section only lists a visual snapshot for the Password story plus typecheck/lint. Consider adding a unit test in keyboard-full.spec.ts asserting that inputType is actually forwarded to the embedded obc-text-input-field's .type (e.g., set inputType = HTMLInputTypeAttribute.Password and assert the rendered obc-text-input-field's type property). A visual snapshot alone won't catch a regression in the binding itself.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-07-07-keyboard-full-input-type-design.md` around
lines 63 - 67, Add unit test coverage for the forwarding contract in
keyboard-full.spec.ts, not just the Password visual snapshot. Create a test that
sets inputType to HTMLInputTypeAttribute.Password and verifies the embedded
obc-text-input-field receives the same value through its .type property, so the
binding is exercised directly. Keep the existing snapshot/typecheck/lint checks,
but make sure the new spec explicitly asserts the inputType-to-type forwarding
behavior.

69-73: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider documenting the date/time limitation explicitly.

The doc calls out that email/tel/url "become available for free" but doesn't mention date/time, both also part of HTMLInputTypeAttribute. Since this keyboard drives the embedded field's value via property assignment (this.value) rather than simulated native keystrokes, arbitrary characters typed for date/time inputs generally won't conform to the strict format native <input type="date"|"time"> requires for its displayed value — so the field may visually appear empty/unchanged even though value-change/done-click still carry the typed string. Worth an explicit note (or scoping the exposed options) so consumers don't silently hit this.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-07-07-keyboard-full-input-type-design.md` around
lines 69 - 73, Document the `date`/`time` limitation in the keyboard full input
type spec, since `obc-keyboard-full` exposes `HTMLInputTypeAttribute` values but
updates the embedded field through `this.value` assignment rather than native
keystroke simulation. In the spec/story/docs section that currently mentions
email/tel/url, add an explicit note that `date` and `time` inputs may not
visually update or may appear unchanged unless the typed string matches the
native format, even though `value-change` and `done-click` still emit the raw
string. If needed, scope the exposed options in the
`KeyboardFull`/`HTMLInputTypeAttribute` docs so consumers understand the
limitation.
packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.ts (1)

708-708: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Verify behavior for date/time inputType values.

Forwarding this.inputType here is correct for text/password/email/tel/url/search, since those accept arbitrary typed strings and (for text/search/url/tel/password) still support cursor tracking via selectionStart. For date/time, selectionStart reads as null on those types (confirmed: per WHATWG/MDN, selectionStart only applies to text/search/url/tel/password; other types return null on read), so the existing null-guards in onKeyPress/onCursorLeft/onCursorRight etc. degrade gracefully to append/no-op rather than throwing — no crash. However, since <input type="date"|"time"> requires a strict conforming value format, free-text key presses routed through this.value.value=${this.value} likely won't render visibly in the embedded field for those two types, even though value-change/done-click still emit the raw string. Since the Storybook inputType select control (stories.ts:93-101) exposes all 8 enum values including date/time with no caveat, a consumer could pick a non-functional-looking configuration.

Consider either restricting the exposed/supported values to the ones that behave as expected (text/password/email/tel/url/search), or documenting the date/time caveat in the property JSDoc.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.ts`
at line 708, The keyboard-full component currently forwards this.inputType to
the embedded input, but date and time do not behave like the text-like types
supported by the keyboard. Update the keyboard-full behavior around the input
binding and related inputType handling so the supported values are limited to
the modes that accept typed strings, or clearly document in the inputType
property JSDoc and Storybook controls that date/time are a special case with
non-visual/raw-value behavior. Use the inputType setter/binding and the
onKeyPress/onCursorLeft/onCursorRight paths to keep the supported contract
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/superpowers/specs/2026-07-07-keyboard-full-input-type-design.md`:
- Around line 63-67: Add unit test coverage for the forwarding contract in
keyboard-full.spec.ts, not just the Password visual snapshot. Create a test that
sets inputType to HTMLInputTypeAttribute.Password and verifies the embedded
obc-text-input-field receives the same value through its .type property, so the
binding is exercised directly. Keep the existing snapshot/typecheck/lint checks,
but make sure the new spec explicitly asserts the inputType-to-type forwarding
behavior.
- Around line 69-73: Document the `date`/`time` limitation in the keyboard full
input type spec, since `obc-keyboard-full` exposes `HTMLInputTypeAttribute`
values but updates the embedded field through `this.value` assignment rather
than native keystroke simulation. In the spec/story/docs section that currently
mentions email/tel/url, add an explicit note that `date` and `time` inputs may
not visually update or may appear unchanged unless the typed string matches the
native format, even though `value-change` and `done-click` still emit the raw
string. If needed, scope the exposed options in the
`KeyboardFull`/`HTMLInputTypeAttribute` docs so consumers understand the
limitation.

In
`@packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.ts`:
- Line 708: The keyboard-full component currently forwards this.inputType to the
embedded input, but date and time do not behave like the text-like types
supported by the keyboard. Update the keyboard-full behavior around the input
binding and related inputType handling so the supported values are limited to
the modes that accept typed strings, or clearly document in the inputType
property JSDoc and Storybook controls that date/time are a special case with
non-visual/raw-value behavior. Use the inputType setter/binding and the
onKeyPress/onCursorLeft/onCursorRight paths to keep the supported contract
consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ff2632f2-b5ee-4b33-8d8a-480240623c49

📥 Commits

Reviewing files that changed from the base of the PR and between 93c83d3 and 7885964.

⛔ Files ignored due to path filters (1)
  • packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/keyboard-full/keyboard-full.stories.ts/password-auto.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • docs/superpowers/specs/2026-07-07-keyboard-full-input-type-design.md
  • packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.stories.ts
  • packages/openbridge-webcomponents/src/components/keyboard-full/keyboard-full.ts

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ludvigovrevik exclude the plan

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 6748ada.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants