-
-
Notifications
You must be signed in to change notification settings - Fork 49
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 SelectField MenuOption icons and non-collapsing toggle button. #155
Conversation
🦋 Changeset detectedLatest commit: 0fbcdc1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@willnationsdev I re-setup Vercel deployments (and switch to the SvelteKit auto adapter). Can you sync this branch with |
c221879
to
5560420
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This PR actually wasn't a regression but an improvement :). With that said, could you update the changeset? Also, you use update this example (with a different name) to leverage options with We might need to adjust passing Thanks! |
5560420
to
980596b
Compare
980596b
to
1bd8889
Compare
Gotcha. Makes sense now that I think about it since you never actually deployed, so there's no "regression" to fix. I updated the changeset accordingly. I also updated the example in the docs so that it shows how to individually control both the text & icon color within both the field & the menu items. I also noticed, in the process, that the way I was passing the I also modified the description of this PR so that it would close the relevant issue (since it now includes changes that fulfill the remaining tasks in there). |
1bd8889
to
869ad37
Compare
869ad37
to
dbb31b6
Compare
Also, I'm not really sure, but is the |
Good catch, but it wasn't a regression with your changes :). Here is a preview before the merge for reference. I think the issue is I changed autoPlacement to true by default, which picks the side of the viewport with the most space. Regarding the button toggle, I see you currently ignore the click if press it, which I think feels wrong (and should toggle close). CleanShot.2023-12-20.at.09.58.02.mp4It also reveals an odd issue I've seen that I think is a Svelte bug (hoping Svelte 5 just fixes it, but haven't had time to test). I think the issue is initial prop values are not set when something transitions in/out quickly (at least that's ben the best I could figure out. Basically What if we don't worry about this toggle issue ATM and ship the other improvements, and we can circle back later. If you're OK with that, would you mind backing our those changes (including the new |
dbb31b6
to
4c6e01d
Compare
The issue is that the toggle button triggers and I flip the
That's fine too. I've pushed an update that removes those changes, but I also have a local backup if you end up wanting it restored. Although, if you have another solution in mind that I didn't think of, then I'm all ears since I'm still pretty intermediate-level when it comes to frontend web development. |
I appreciate you taking a stab at it, and that might be an approach we can leverage. I recall taking a few attempts at it, hoping to leverage I might be able to use some kind of setTimeout() "cooloff" to handle the toggling, similar to how Tooltip changes the delay based on any if Tooltip was shown in the last 500ms (not exactly the same thing or how we would handle it, but a possible approach). I think for the time being I'd rather leave it as is (a little simpler) until I have a little more bandwidth to really think about it, if you're OK with that :). Also, I just realized I already have most of this tracked in #91 and #93, so if you're happy, I'm good with merging this PR and closing #132, and tracking those issues separately. |
Yeah, that sounds like a good plan to me. Thank you so much for being responsive/active/advisory with regards to all these changes. :-D |
@techniq I actually came up with a much smoother & simpler solution that solves the button toggle in a similar vein as before, but without being quite so picky about the elements involved or having to extract elements from other components. Check it out, and let me know if you'd like me to add it to this PR. |
@willnationsdev Welcome, I try my best :) I like that approach much better, although it looks like it still would cancel the closing of the menu if clicked on the toggle icon/button, and I feel that icon should always toggle open or close based on the current state. Btw, Popover has a similar "clickOutside" check based on 2 elements (anchor/trigger element, and the popover itself). I first thought I had a With that said, do you think clicking the toggle icon/button should still open/close based on the current state? |
It still opens/closes based on the current state. The problem was that when clicking on the toggle button to close, the Although, now I'm finding that the blur event is never properly hiding the menu if you tab away from the SelectField, so some adjustment is still necessary, even if it's moving in a better direction. Something about detecting which area was clicked on & then leveraging that. |
@willnationsdev I forget where we left this one exactly. I believe you were investigating the chevron clicking issue and improving that interaction. Once #167 is merged (hopefully in the next 2 weeks), could you rebase this PR and we'll see what remains? Thanks! |
Yeah, sounds good. I'll do that. |
@willnationsdev |
@techniq Okay, will do. Might be later tonight, but I'll do it ASAP. |
No rush :) |
4c6e01d
to
ead4d54
Compare
Thanks @willnationsdev. I ran I did a quick comparison and noticed the menu items are no longer receiving their
Related note: I need to take a good hard look at how we apply class/classes across all components with have a simple/repeatable process (without introducing any regressions). I started tracking this in #245 for reference. |
@willnationsdev It's because of how |
@willnationsdev Going to close this for now, but feel free to re-open |
Related to #132.