Skip to content

Fix autosize#125

Merged
severo merged 4 commits intomasterfrom
fix-autosize
Apr 16, 2025
Merged

Fix autosize#125
severo merged 4 commits intomasterfrom
fix-autosize

Conversation

@severo
Copy link
Copy Markdown
Contributor

@severo severo commented Apr 16, 2025

Add 1px to avoid rounding errors when using offsetWidth. An alternative is to use getBoundingClientRect, but maybe it's good enough this way and less resource-consuming (even if it's a micro-optimization).

Screenshot From 2025-04-16 17-20-32

Also (a bit unrelated to the PR matter): remove aria-disabled (potentially breaking, even if it had been added recently) and always use aria-sort to style, as it's clearer semantically.

Before:

Screenshot From 2025-04-16 17-25-23

After:

Screenshot From 2025-04-16 17-25-09

severo added 4 commits April 16, 2025 17:06
and apply styles depending on the existence of aria-sort, instead
of `[aria-disabled="false"]` which is not as self-explaining.
@severo severo requested review from platypii and removed request for platypii April 16, 2025 15:27
@severo
Copy link
Copy Markdown
Contributor Author

severo commented Apr 16, 2025

cc @platypii @bleakley for visibility

@severo severo merged commit b0de116 into master Apr 16, 2025
10 checks passed
@severo severo deleted the fix-autosize branch April 16, 2025 15:27
@severo severo mentioned this pull request Apr 16, 2025
severo added a commit that referenced this pull request Mar 4, 2026
Since #125, the aria-sort
attribute on column headers incorrectly encoded if the column could be
sorted. But in the read-only case, the order is set, but no interaction
is possible. We add a new 'data-can-sort' attribute to split concerns:

- aria-sort recovers its semantics: what is the current order used for
  the displayed contents
- data-can-sort tells if the column header provides interactions for
  sorting the column

It's theoritically a breaking change in the CSS. In reality, I don't
expect anyone to rely on it.
severo added a commit that referenced this pull request Mar 5, 2026
…derByProvider (#458)

* no need for useMemo here

* [refactor] split orderBy from setOrderBy in context

* remove unneeded context providers

* remove useless orderBySize

* [refactor] move logic from components to OrderByProvider

* add TODOs

* Update src/contexts/OrderByContext.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix logic and types

* fix tests (found by copilot)

* fix logic when sortable and orderBy have a contradiction

* BREAKING (CSS) move part of the style to new 'data-can-sort' attribute

Since #125, the aria-sort
attribute on column headers incorrectly encoded if the column could be
sorted. But in the read-only case, the order is set, but no interaction
is possible. We add a new 'data-can-sort' attribute to split concerns:

- aria-sort recovers its semantics: what is the current order used for
  the displayed contents
- data-can-sort tells if the column header provides interactions for
  sorting the column

It's theoritically a breaking change in the CSS. In reality, I don't
expect anyone to rely on it.

* add a comment about context split while both values are updated at the same time

* add a todo

* use the same logic in functional header for ⇅

* fix test

* make code more explicit

* retry, with aria-disabled instead of disabled

* add a comment for clarity on the logic

* add a test to show priority of 'sortable' over 'orderBy' in case of contradiction

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

1 participant