Skip to content

Conversation

Mister-Hope
Copy link
Member

No description provided.

@Mister-Hope Mister-Hope requested review from pengzhanbo and Copilot June 4, 2025 11:08
Copy link

@Copilot 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

This PR replaces the hardcoded id prop on tabs with dynamic IDs generated by Vue’s useId() to ensure uniqueness and simplify usage.

  • Removed id attribute from snapshots and source generators for both <Tabs> and <CodeTabs>.
  • Integrated useId() in client components to assign unique ARIA controls and panel IDs.
  • Cleaned up prop definitions by removing the now-unused id prop.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

File Description
plugins/markdown/plugin-markdown-tab/tests/node/snapshots/*.spec.ts.snap Updated snapshots to remove the hardcoded id="0" attribute
plugins/markdown/plugin-markdown-tab/src/node/{tabs,codeTabs}.ts Removed id interpolation from server render output
plugins/markdown/plugin-markdown-tab/src/client/components/Tabs.ts Imported useId(), removed id prop, generate dynamic IDs
plugins/markdown/plugin-markdown-tab/src/client/components/CodeTabs.ts Same updates as Tabs.ts, using useId() for unique IDs
Comments suppressed due to low confidence (3)

plugins/markdown/plugin-markdown-tab/src/client/components/Tabs.ts:68

  • [nitpick] Consider renaming ids to something more descriptive like tabPanelIds to clarify its purpose.
let ids = props.data.map(() => useId())

plugins/markdown/plugin-markdown-tab/src/client/components/CodeTabs.ts:66

  • [nitpick] Rename ids to codeTabPanelIds (or similar) to make its role explicit for code tabs.
let ids = props.data.map(() => useId())

plugins/markdown/plugin-markdown-tab/src/client/components/Tabs.ts:121

  • [nitpick] Add a brief comment explaining why useId() is used here (e.g. to generate stable ARIA IDs) to aid future maintainers.
// only update ids in dev mode

@coveralls
Copy link

Pull Request Test Coverage Report for Build 15440709936

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 59.517%

Totals Coverage Status
Change from base Build 15440071823: 0.0%
Covered Lines: 1358
Relevant Lines: 2058

💛 - Coveralls

@Mister-Hope Mister-Hope merged commit 3fdaf2b into main Jun 4, 2025
30 checks passed
@Mister-Hope Mister-Hope deleted the tab-id branch June 4, 2025 11:44
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