-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
NEXT: NavTile - manual selection handling #3227
Comments
I understand the logic and reasoning behind this change, but I don't really like the proposed solution of using null. I think it's better to write an else if of some sort for the if(selected !== undefined) {
// set explicitly by user, takes priority
} else {
// context value check
} I haven't tested the solution properly, but I believe |
Oh, true, that's indeed a better solution. I already considered doing it this way but somehow didn't proceed to check it. Will open a PR in a minute. |
NOTE: This might be the solution to #3198 as well. I can test it once again after the PR for this issue is merged. FYI @endigo9740 |
Navigation.Tile#id
nullable to use manual selection handling
@phamduylong feel free to restest #3198 please sir! |
NavTile.svelte
uses thevalue
of theNavBar
in its context to compare its ID to this value to determine whether the tile is selected or not.skeleton/packages/skeleton-svelte/src/lib/components/Navigation/NavTile.svelte
Line 52 in 9eb7881
However, this results in tiles that have manual selection handling incorrectly assuming this state even when explicitly set not to.
In 863c9cf,
Navigation.Tile
'sid
prop was made generated by default.Instead, I propose to add an explicit
| null
to theid
prop.skeleton/packages/skeleton-svelte/src/lib/components/Navigation/types.ts
Line 102 in 863c9cf
The existing
useId
will run when the property isundefined
(unspecified) as it is right now. When it is set tonull
explicitly however, the new logic should only respect theselected
property.Here's a video demonstrating the current issue (not embedded for some reason, simply open the link in your browser):
https://github.com/user-attachments/assets/5cde5442-bb71-4d92-9ec2-2c02101c4c78
I would love to contribute this change myself after confirming the logic.
Original post on Discord: https://discord.com/channels/1003691521280856084/1191790107867488316/1340676288838373510
The text was updated successfully, but these errors were encountered: