-
Notifications
You must be signed in to change notification settings - Fork 195
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: adding max height and full height to picker menu component #3051
base: main
Are you sure you want to change the base?
Changes from all commits
b8b7aa9
f0cfb1e
0cb9496
dc77410
002c065
5641c1c
ec4f491
ef24086
fbc95ca
5d313e7
1e39eff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@spectrum-css/popover": minor | ||
"@spectrum-css/picker": minor | ||
--- | ||
|
||
Adding the ability to define height in popover and pass the variable to picker |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@spectrum-css/picker": major | ||
--- | ||
|
||
Removing full height mod and keeping max block size for fixed menu height |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@spectrum-css/picker": major | ||
--- | ||
|
||
Adding max height to picker menu |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@spectrum-css/popover": minor | ||
"@spectrum-css/picker": minor | ||
--- | ||
|
||
Adding max block size utility in popover so that other components such as picker can use it |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -491,3 +491,10 @@ | |
color: var(--highcontrast-picker-content-color-disabled, var(--mod-picker-font-color-disabled, var(--spectrum-picker-font-color-disabled))); | ||
} | ||
} | ||
|
||
/* Fixed menu height */ | ||
.spectrum-Picker--menu-height-fixed { | ||
& + .spectrum-Popover.is-open { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For specificity, I think it's necessary. It also gives other devs more context. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the render function in the
Users now have a hook to set a 200px fixed height if they so wish. If the design guidance is to default to 200px, that's a breaking change so maybe we can make note of it to add in the future and deprecate a block-size of auto? |
||
--mod-popover-max-block-size: 200px; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ export const Picker = ({ | |
customClasses = [], | ||
customStyles = {}, | ||
onclick, | ||
menuHeight = false, | ||
} = {}, context = {}) => { | ||
return html` | ||
<button | ||
|
@@ -39,6 +40,7 @@ export const Picker = ({ | |
["is-open"]: isOpen, | ||
["is-loading"]: isLoading, | ||
["is-keyboardFocused"]: isKeyboardFocused, | ||
[`${rootClass}--menu-height-fixed`]: menuHeight, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we considered the pros and cons of not having a dedicated API for this feature? For instance, instead of having a specific menu-height class, we could use a generic mod variable applied to the base class. This mod variable would function as a feature toggle, although customers would need to define its value themselves (because we would not have a default fallback). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I guess this is a more holistic API design question, maybe the CSS team can help understand when a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, this feels like a good use-case to add a mod rather than new API. |
||
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}), | ||
})} | ||
?disabled=${isDisabled} | ||
|
@@ -88,8 +90,8 @@ export const Template = ({ | |
withSwitch = false, | ||
fieldLabelStyle = {}, | ||
customClasses = [], | ||
customStyles = {}, | ||
content = [], | ||
menuHeight = false, | ||
id = getRandomId("picker"), | ||
} = {}, context = {}) => { | ||
const { updateArgs } = context; | ||
|
@@ -136,13 +138,10 @@ export const Template = ({ | |
isDisabled, | ||
isReadOnly, | ||
customClasses, | ||
customStyles: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where did these go? 😛 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rubencarvalho I removed the inline styling of the Picker because it was displaying the label and button inline and overriding the flex-box styling and disrupting the text wrap especially when the label was displayed left. So I "turned it off" by removing this block. I can bring it back if needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, thanks for the context! I thought it was a forgotten edit 😄 |
||
"display": labelPosition == "left" ? "inline-block" : undefined, | ||
...customStyles, | ||
}, | ||
content, | ||
iconName, | ||
labelPosition, | ||
menuHeight, | ||
id, | ||
onclick: function() { | ||
updateArgs({ isOpen: !isOpen }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a major bump? Seems like this feature is non-breaking.