Skip to content

Feature - implement huxInlineEditor pattern#43

Open
Copilot wants to merge 20 commits into
mainfrom
copilot/add-inline-editor-component
Open

Feature - implement huxInlineEditor pattern#43
Copilot wants to merge 20 commits into
mainfrom
copilot/add-inline-editor-component

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

This pull request introduces a new Alpine.js pattern for inline editing, providing both implementation and documentation. The main change is the addition of a reusable huxInlineEditor Alpine data object, which manages toggling between read and edit modes, keyboard shortcuts, focus management, and event dispatching for commit/revert actions. Comprehensive documentation is also included to guide usage, configuration, and accessibility.

Inline editor implementation:

  • Added a new huxInlineEditor Alpine data object in PatternRegistration.astro, supporting edit mode toggling, input management, keyboard shortcuts (Enter/Escape), focus trapping, and robust focus restoration after editing.

Documentation:

  • Added a new documentation page inline-editor.mdx describing the API, usage patterns, options, behavior contract, error handling, and accessibility guidance for the huxInlineEditor pattern.

Copilot AI linked an issue May 21, 2026 that may be closed by this pull request
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/1e90af84-83de-4e91-acf0-4a2cb3846f0e

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown
Contributor

cloudflare-workers-and-pages Bot commented May 21, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperux e18448d Commit Preview URL

Branch Preview URL
May 23 2026, 06:18 PM

Copilot AI changed the title [WIP] Add inline editor pattern/component Feature - Add behavior-first Inline Editor pattern May 21, 2026
Copilot AI requested a review from markmead May 21, 2026 15:42
Copilot AI and others added 3 commits May 21, 2026 16:13
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/cc489f25-c85c-4922-a027-eda388dcd11b

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/cc489f25-c85c-4922-a027-eda388dcd11b

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/cc489f25-c85c-4922-a027-eda388dcd11b

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
@markmead markmead requested a review from Copilot May 21, 2026 16:17
@markmead markmead added the enhancement New feature or request label May 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Inline Editor” pattern to HyperUX, including a demo, docs, and an Alpine registration script that supports the inputValue state (with backward-compatible value fallback).

Changes:

  • Introduces huxInlineEditor Alpine data component registration (state, commit/revert, focus trapping, events).
  • Adds an Inline Editor demo component wired to the new registration and copy-to-clipboard integration.
  • Adds a full pattern documentation page for Inline Editor using the repo’s behavior-first documentation structure.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/content/patterns/inline-editor.mdx New Inline Editor pattern documentation page (API, options, usage, behavior, a11y).
src/components/PatternRegistration.astro Registers new huxInlineEditor Alpine data component and emits commit/revert events.
src/components/demos/InlineEditor.astro New demo showcasing read/edit swap, focus trap, and keyboard commit/revert behavior.
Comments suppressed due to low confidence (1)

src/content/patterns/inline-editor.mdx:141

  • This error-handling description is stricter than the implementation: the component only logs the missing x-ref error after it fails to resolve any input/textarea (it falls back to querying input, textarea inside the focus-trap root). Missing the configured x-ref alone won’t necessarily log. Please update the wording to match the actual logging condition.
- If the configured input ref is missing when edit mode starts, the component logs:
  `[huxInlineEditor] Missing x-ref target for inlineEditorInput.` by default. If you override
  `inputTemplateRef`, the logged value uses that configured ref name.
- Missing optional listeners do not affect commit/revert behavior.

Comment thread src/components/PatternRegistration.astro Outdated
Comment thread src/content/patterns/inline-editor.mdx Outdated
@markmead
Copy link
Copy Markdown
Owner

@copilot Address the feedback – it is an issue. I'm unsure on the best approach, I previously mentioned that we could use x-show x-cloak x-transition instead of x-if, but you brushed that off. Maybe that is the fix? Plus, it would add some UI polish.

Copilot AI and others added 4 commits May 21, 2026 16:29
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/e2d8942d-06d9-440c-a267-d53800bc6dc3

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/e2d8942d-06d9-440c-a267-d53800bc6dc3

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
Agent-Logs-Url: https://github.com/markmead/hyperux/sessions/e2d8942d-06d9-440c-a267-d53800bc6dc3

Co-authored-by: markmead <50486078+markmead@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot Address the feedback – it is an issue. I'm unsure on the best approach, I previously mentioned that we could use x-show x-cloak x-transition instead of x-if, but you brushed that off. M...

Implemented in f287745 (with follow-up polish through d3266a2): focus restoration is now reliable when the prior element is disconnected, and the demo/docs were switched to x-show + x-cloak + x-transition for the UI polish/stable focus-target approach you suggested. Screenshot: inline editor update

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.google.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro dev --host 0.0.0.0 --port 4321 _TOKEN&#34;; }; f (dns block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro dev --host 0.0.0.0 --port 4321 _TOKEN&#34;; }; f (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro dev --host 0.0.0.0 --port 4321 _TOKEN&#34;; }; f (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread src/components/PatternRegistration.astro Outdated
Comment thread src/components/PatternRegistration.astro
Comment thread src/content/patterns/inline-editor.mdx Outdated
Comment thread src/content/patterns/inline-editor.mdx Outdated
Comment thread src/content/patterns/inline-editor.mdx Outdated
@markmead
Copy link
Copy Markdown
Owner

@copilot Address the PR feedback.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Address the PR feedback.

Done in 3f4d1d4. I addressed the PR feedback by removing the value alias from huxInlineEditor, switching focus retries to a cancelable requestAnimationFrame flow that stops outside edit mode, and updating inline-editor docs for accessibility/behavior accuracy (including label-wrapped input and error-handling text). Screenshot: inline editor update

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro check (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro check (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@markmead markmead changed the title Feature - Add behavior-first Inline Editor pattern Feature - implement huxInlineEditor pattern May 23, 2026
markmead added 2 commits May 23, 2026 14:02
Clean up InlineEditor component markup: wrap the paragraph text for readability, consolidate x-cloak/x-show onto single lines and remove x-transition.opacity attributes. Adjust the input classes to use explicit border and updated padding (removed fixed height h-10, added border, px-4 and py-2) for improved sizing and visual consistency.
@markmead markmead marked this pull request as ready for review May 23, 2026 13:05
markmead added 2 commits May 23, 2026 14:14
Reformat the inline editor container element so each Alpine attribute is on its own line (x-show, x-cloak, x-transition, x-ref, x-on:keydown). This improves readability and aligns the markup with the project's preferred element formatting.
Replace the single inline editor demo with a multi-field "Edit profile" section. Swap the root div for a section and add a header and badge, then introduce a responsive grid of inline editor cards (Display name, Headline, Location, Website, Username, Pronouns). Each card uses x-data="huxInlineEditor(...)" and includes view/edit states, inputs, and Save/Cancel controls; keyboard/focus trapping and ARIA attributes are preserved. Remove the previous single-editor tip paragraph and adjust spacing and styling for the new layout.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment on lines +591 to +592
targetElement.focus()
this.selectInputText(targetElement)
Comment thread src/components/demos/InlineEditor.astro Outdated
Comment on lines +68 to +73
aria-describedby="profile-inline-editor-help"
class="min-w-0 flex-1 rounded-md border border-gray-300 px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:outline-none"
x-on:focus="handleInputFocus($event)"
x-on:keydown="handleInputKeydown($event)"
/>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove it – I don't think it's needed.

Comment thread src/components/demos/InlineEditor.astro
Comment on lines +90 to +97
<input
x-ref="inlineEditorInput"
x-model="draftValue"
type="text"
x-init="registerInput($el)"
aria-describedby="profile-name-inline-editor-help"
x-on:focus="handleInputFocus($event)"
x-on:keydown="handleInputKeydown($event)"
@markmead
Copy link
Copy Markdown
Owner

@copilot Address the feedback.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Address the feedback.

Done in e18448d. I addressed the feedback by preventing registerInput() from focusing/selecting unless edit mode is active, and removed the unnecessary aria-describedby attributes from demo inputs. Screenshot: inline editor demo update

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro check (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/astro check (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from markmead May 23, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Inline Editor" pattern/component

3 participants