Skip to content

Conversation

@YusukeHirao
Copy link
Member

Summary

Add Markuplint rule to require command attribute on button[type=button] elements, enforcing Invoker Commands API usage for accessible UI implementation.

Changes

1. New Markuplint Rules

  • Require command attribute on button[type=button]

    • Selector: button[type=button]:not([role]):not([popovertarget])
    • Exceptions: buttons with role attribute, form buttons (submit/reset/no type)
  • Encourage popovertarget migration

    • Selector: button[popovertarget]:not([command]):not([role]):not([type=submit]):not([type=reset])
    • Displays dedicated message recommending Invoker Commands API migration

2. Documentation

  • Updated README to document all included rules in the config
  • Added comprehensive rule descriptions with examples

3. Tests

  • Added comprehensive test cases covering:
    • type="button" buttons requiring command attribute
    • Exception cases (role attributes, form buttons)
    • popovertarget migration warnings
    • Edge cases and multiple attribute combinations

Test Plan

  • ✅ All 109 tests passing
  • ✅ Button Command Attribute test validates all scenarios
  • ✅ Existing tests remain unaffected

🤖 Generated with Claude Code

YusukeHirao and others added 2 commits January 20, 2026 17:35
Add rule to enforce Invoker Commands API usage on button elements with type="button".

Two separate rules are added:

1. Require command attribute on button[type=button] elements

   - Exceptions: buttons with role attribute, form buttons (submit/reset/no type)

2. Encourage migration from popovertarget to Invoker Commands API

   - Display dedicated message for buttons with popovertarget attribute

Update README to document all included rules in the config.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive test cases for the new button command attribute validation:

- Test type="button" buttons requiring command attribute

- Test exceptions: role attributes, form buttons (submit/reset/no type)

- Test popovertarget migration warning

- Test edge cases and multiple attribute combinations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@YusukeHirao YusukeHirao requested a review from arktds January 20, 2026 08:56
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