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(multi-select): remove absolute positioning of filterable tag, update input spacing #4760

Closed
wants to merge 2 commits into from

Conversation

jendowns
Copy link
Contributor

Closes #4721

#4721 appears to be caused by an absolutely positioned tag. The tag sits on top of the filter input, so as the number inside the tag grows it will continue to encroach on the filter input's text.

This fix removes absolute positioning for that selected items tag.

A side effect of this is that when you select the filter input now, the focus outline will no longer extend / wrap everything --

Old (with 10+ selected items):

Screen Shot 2019-11-22 at 1 13 34 PM

New (with 10+ selected items):

Screen Shot 2019-11-22 at 1 13 17 PM

☝️ For the spacing above, I can definitely adjust the split between spacing inside the input and spacing between the input and the tag. Just let me know what you prefer!

But due to the structure of this component, this seems like the easiest fix. I imagine with a bigger refactor + involving some JS, you could possibly keep the tag on top of the input and just steadily adjust the input's left padding to accommodate a growing "selected items" number in the tag. That seems like a lot of overhead though 😅 What do you all think?

Changelog

Changed

  • change absolutely positioned tag and distribute spacing between tag and input.

@jendowns jendowns requested a review from a team as a code owner November 22, 2019 19:19
@ghost ghost requested review from asudoh and joshblack November 22, 2019 19:19
@jendowns jendowns changed the title fix(multi-select): remove absolute positioning of filterable tag, update filter input style fix(multi-select): remove absolute positioning of filterable tag, update input spacing Nov 22, 2019
@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for the-carbon-components ready!

Built with commit 2adc449

https://deploy-preview-4760--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for carbon-components-react ready!

Built with commit 2adc449

https://deploy-preview-4760--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for carbon-elements ready!

Built with commit 2adc449

https://deploy-preview-4760--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for carbon-elements ready!

Built with commit a08f4f3

https://deploy-preview-4760--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for carbon-components-react ready!

Built with commit a08f4f3

https://deploy-preview-4760--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for the-carbon-components ready!

Built with commit a08f4f3

https://deploy-preview-4760--the-carbon-components.netlify.com

@asudoh asudoh requested a review from a team November 23, 2019 01:04
@ghost ghost requested review from laurenmrice and removed request for a team November 23, 2019 01:04
@joshblack
Copy link
Contributor

@jendowns is there any way we could get the focus indicator to span the entire control with this approach? Just going by the screenshots it seems like this detail has changed so wanted to check 👍

Copy link
Contributor

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Left a quick comment above!

@jendowns
Copy link
Contributor Author

Hey @joshblack let me know if this makes sense:

The tag is a sibling of the input. Currently, the tag is absolutely positioned on top of the input. But the tag's content is dynamic / user-controlled. It's not really the same as a static icon with a consistent size, that you can reliably place on top of something with a lot of padding... so, absolutely positioning the tag inside the padding of the underlying input does not work with 10+ selected items.

I don't think there's a way, with CSS alone, to make it so the padding of the input -- where the tag is absolutely positioned on top of -- expands to accommodate a growing character count in the tag. And since they are siblings + the input doesn't have a true label that you could utilize for focus/active state styling, absolute positioning is the only way for the tag to sit anywhere inside a focus outline for the input. 🤔

So that's why I removed the absolute positioning. I don't think it's possible to keep this looking like the non-filterable MultiSelect, unless this underwent a major refactor and/or utilized some JS to dynamically adjust padding for the absolutely positioned tag to sit on.

@joshblack
Copy link
Contributor

@jendowns would you want to pair up to help catch me up on what you've run into and detailed above? Would love to work on this with ya if you have the time!

@jendowns
Copy link
Contributor Author

jendowns commented Dec 5, 2019

Hey @joshblack I was just trying to suggest a way to fix something that is broken at the moment. 😅 The tag is absolutely positioned, yet is dynamic content... and it's locked up next to an input. It will continue to overlap the input as the dynamic content (i.e., character counter of tag content) changes.

So I just wanted to suggest making it not absolutely positioned as a quick fix so the input isn't covered anymore.

Preserving the focus outline would need a component refactor of some level. If you'd prefer that route instead, I can close out this PR. Let me know -- thank you!

@joshblack
Copy link
Contributor

@jendowns totally fair! Sorry for the confusion. I think we would like to keep the focus outline on the whole control and definitely would be down to refactor if we need to in order to support the selected count growing 👍

@jendowns jendowns closed this Dec 5, 2019
@jendowns jendowns deleted the 4721_multiselect branch December 5, 2019 19:28
@wkeese
Copy link
Contributor

wkeese commented Dec 11, 2020

I would think you'd need flexbox sizing to let the app specify the total width of the multiselect, and it would give the buttons however much space they need, and give the rest of the space to the <input>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filterable Multiselect tag encroaches on filter text when 10 or more selected
4 participants