Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Tab-Group Header not displayed #2557

Merged
merged 11 commits into from
Jul 13, 2024
6 changes: 5 additions & 1 deletion packages/vue-components/src/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:class="{'disabled': disabledBool}"
data-bs-toggle="dropdown"
>
<slot name="header"></slot>
<span v-html="tabgroupHeader"></span>

Check warning on line 14 in packages/vue-components/src/Dropdown.vue

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'v-html' directive can lead to XSS attack

Check warning on line 14 in packages/vue-components/src/Dropdown.vue

View workflow job for this annotation

GitHub Actions / test (macos-latest)

'v-html' directive can lead to XSS attack

Check warning on line 14 in packages/vue-components/src/Dropdown.vue

View workflow job for this annotation

GitHub Actions / test (windows-latest)

'v-html' directive can lead to XSS attack
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I'm not keen on this naming since this is only true for tab groups but not for other headers.
Could we keep the header name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! The rationale was give greater differentiation in the way the header is passed as a prop instead of relying on slot conversion, but it is evident from the code directly.

I would be down to try writing some test cases for the tabs! Test cases would also prevent any further regressions until a better way to pass down the header is found.

Copy link
Contributor Author

@gerteck gerteck Jul 3, 2024

Choose a reason for hiding this comment

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

I just realised that setting it as the same name header causes two of the current tests to fail under dropdown as the header no longer shows up as an attribute in the html rendered.

This is probably because of the slot name and the attribute prop name having the same name.

With that in mind, I think that the tab-group-header prop name should be differentiated from the header slot name as it can get confusing as well.

</a>
</slot>
<slot name="dropdown-menu" :class="[{ 'show': show }, { 'dropdown-menu-end': menuAlignRight }]">
Expand Down Expand Up @@ -70,6 +70,10 @@
type: String,
default: 'light',
},
tabgroupHeader: {
type: String,
default: '',
},
menuAlignRight: {
type: Boolean,
default: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-components/src/Tabset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
v-else
:key="index"
class="nav-item"
:header="t.headerRendered"
:class="{active:t.active}"
:tabgroup-header="t.headerRendered"
:disabled="t.disabled"
>
<li v-for="(tab, tabIndex) in t.tabs" :key="tabIndex">
Expand Down
Loading