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

Allow links in table headers #5362

Open
apollo13 opened this issue Oct 2, 2024 · 5 comments
Open

Allow links in table headers #5362

apollo13 opened this issue Oct 2, 2024 · 5 comments
Labels
P3 Triaged Issue has been reviewed as part of legacy backlog grooming (project P3). Triaged: new architecture Triaged, to be addressed in new architecture of the design system

Comments

@apollo13
Copy link

apollo13 commented Oct 2, 2024

Currently when a table header is sortable, the sort functionality is implemented via Javascript. I'd like to sort without javascript via a standard link to the server ala /some_page/?sort=-col3. Adjusting the HTML like this:

<th aria-sort="none" class="u-align--right">
  <a href="/some_page/?sort=-col3">Cores</a>
</th>

does work but has the following problem: The th styles set the pointer to cursor:

&[aria-sort='ascending']::after {
giving the impression that the whole cell is clickable but the link covers only the text leading to a bad UX.

Not sure about how to fix this best.

@apollo13 apollo13 added the WG: Proposal Working group proposals label Oct 2, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/WD-15546.

This message was autogenerated

@bartaz
Copy link
Member

bartaz commented Oct 2, 2024

Good catch. Indeed, we make an assumption that the whole cell is clickable (as it is with our JS), so adding a link inside can make it confusing.

It may not be trivial for us to remove this assumption from Vanilla now (as the sortable functionality and styling depends on this currently).
A workaround could be to override the cursor styling on your side, by resetting it back to default:

This would do it for all the tables:

table th[aria-sort] {
    cursor: default;
}

Or you could introduce your own class to target specific tables:

table.p-table--sortable-on-server th[aria-sort] {
    cursor: default;
}

Would that help?

@apollo13
Copy link
Author

apollo13 commented Oct 2, 2024

Hi @bartaz, thank you for the quick reply. That does indeed work, but I'd love to have the whole cell clickable. I fully understand that this is not easy to achieve currently though.

@apollo13
Copy link
Author

apollo13 commented Oct 2, 2024

For others stumbling upon this I am currently fixing this via:

th a:visited {
    color: inherit;
}

table th[aria-sort] {
   cursor: default !important;
}

@bartaz
Copy link
Member

bartaz commented Oct 3, 2024

Triage: we are not going to address this in current codebase. More flexibility in table header content can be a consideration for new architecture.

@bartaz bartaz added P3 Triaged Issue has been reviewed as part of legacy backlog grooming (project P3). Triaged: new architecture Triaged, to be addressed in new architecture of the design system and removed WG: Proposal Working group proposals labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Triaged Issue has been reviewed as part of legacy backlog grooming (project P3). Triaged: new architecture Triaged, to be addressed in new architecture of the design system
Projects
None yet
Development

No branches or pull requests

2 participants