Skip to content

fix(parser): keep a <button> inside <select> open - #2580

Open
cruspy2004 wants to merge 1 commit into
fb55:masterfrom
cruspy2004:fix/button-in-select
Open

cruspy2004 wants to merge 1 commit into
fb55:masterfrom
cruspy2004:fix/button-in-select

Conversation

@cruspy2004

@cruspy2004 cruspy2004 commented Nov 20, 2026 •

Copy link
Copy Markdown

Fixes #2579

Opening a <button> closed an open <select>, because button used formTags in openImpliesClose, which includes select. A customizable select may now start with a <button> (whatwg/html#10548), so button gets its own set: the form tags without select.

A button still closes an open button, input, option and the other form tags, as before. The new tests cover the issue's example and nested buttons.

View guided diff

Summary by CodeRabbit

  • Bug Fixes
    • Updated HTML parsing so a <button> inside <select> remains open until its explicit closing tag, preserving customizable select content.
    • A new <button> still implicitly closes an already-open button.

A customizable <select> may start with a <button>, but opening a button closed any open select. A button now leaves an open select alone and still closes the other form tags, including an open button.

Fixes fb55#2579
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T20:51:32.500345Z 0345146 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The parser no longer implicitly closes an open button when it opens a select. Tests verify that button content remains within select and that opening a second button still closes the first.

Changes: Button handling in select

Layer / File(s) Summary
Update and verify button implied-close behavior
src/Parser.ts, src/Parser.spec.ts
The button implied-close rule excludes select. Tests check event order for button content inside select and implicit closure when a second button opens.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: fb55

Merge Risk: Minimal · up to 03451

This change keeps a button as the first child of a select, so later options stay inside the select. It is narrow in scope and tested, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(parser): keep a inside open" matches the main change. The parser no longer lets an opening button close an open select, and the PR adds tests for that case. The title …
Linked Issues check Passed Issue #2579 requires that <button> opened inside <select> does not close the select, so later <option> elements stay inside it. At the reviewed head, src/Parser.ts defines buttonTags as `for…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches only src/Parser.ts and src/Parser.spec.ts. In src/Parser.ts, the change adds buttonTags (form tags without select), uses it for button only…
Full details: Title check

Explanation

The title "fix(parser): keep a <button> inside <select> open" matches the main change. The parser no longer lets an opening button close an open select, and the PR adds tests for that case. The title is specific, concise, and follows a conventional commit style. It does not mention the retained behavior for other form tags, which is acceptable because it is not the main point.

Full details: Linked Issues check

Explanation

Issue #2579 requires that &lt;button&gt; opened inside &lt;select&gt; does not close the select, so later &lt;option&gt; elements stay inside it. At the reviewed head, src/Parser.ts defines buttonTags as formTags minus select, and maps button to buttonTags in openImpliesClose. When &lt;button&gt; opens while &lt;select&gt; is the open element, select is not in the set, so the select stays open. The new test in src/Parser.spec.ts checks the issue example &lt;select&gt;&lt;button&gt;&lt;selectedcontent&gt;&lt;/selectedcontent&gt;&lt;/button&gt;&lt;option&gt;A&lt;/option&gt;&lt;/select&gt; and expects the full event sequence, including &lt;/select&gt; after the option. Existing button closing behavior is kept because buttonTags retains the other form tags. The new test &lt;button&gt;A&lt;button&gt;B checks that a new button still closes an open button. The diff does not show the full formTags set, so the assumption that button is in formTags is inferred from the previous button: formTags mapping. The results are consistent with that assumption. No coding requirement remains unmet. The issue's non-coding context (spec links) needs no action.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches only src/Parser.ts and src/Parser.spec.ts. In src/Parser.ts, the change adds buttonTags (form tags without select), uses it for button only, and adds a comment explaining the customizable select case. All other openImpliesClose entries keep formTags. In src/Parser.spec.ts, both added tests cover the linked issue's behavior (button inside select) and the retained button-closes-button behavior. Every change is tied to issue #2579 or supports its tests. No unrelated change was found.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit reads the parser’s rule,
A button stays inside the select.
Selected content follows along,
Until its closing tag appears.
A second button closes the first,
Then hops away through tidy trees.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ea661ca1-8544-4043-a9e4-ccd9bd8e3930
Commits

Reviewing files that changed from the base of the PR and between 15801e7 and 0345146.

Files selected for processing: 2

  • src/Parser.spec.ts
  • src/Parser.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

View guided diff | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Keeps an open <select> when <button> starts.

  • Buttons inside customizable selects leave the select open.

Reviews (1) · Last reviewed commit: "fix(parser): keep a <button> inside <sel..." · Reviewed by Greptile

This branch has not been deployed

No deployments
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.

<button> inside <select> closes the select (customizable select)

1 participant