-
Notifications
You must be signed in to change notification settings - Fork 72
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
[CCI] Allow to portale BottomBar to any referenced DOM element #758
base: main
Are you sure you want to change the base?
[CCI] Allow to portale BottomBar to any referenced DOM element #758
Conversation
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.
Love this implementation! A few minor comments but overall looks really good
type _BottomBarExclusivePositions = ExclusiveUnion< | ||
{ position?: 'static' | 'sticky' }, | ||
{ | ||
position?: 'fixed'; | ||
/** | ||
* Whether to wrap in an OuiPortal which appends the component to the body element. | ||
* Whether to wrap in OuiPortal. Can be configured using "insert" prop. | ||
* Only works if `position` is `fixed`. | ||
*/ | ||
usePortal?: boolean; | ||
/** | ||
* Whether the component should apply padding on the document body element to afford for its own displacement height. | ||
* Only works if `usePortal` is true and `position` is `fixed`. | ||
* Configuration for placing children in the DOM. By default, attaches children to the body element. | ||
* Only works if `position` is `fixed` and `usePortal` is true. | ||
*/ | ||
affordForDisplacement?: boolean; | ||
}, | ||
{ | ||
insert?: OuiPortalInsert; | ||
/** | ||
* How to position the bottom bar against its parent. | ||
* Whether the component should apply padding on the document body element to afford for its own displacement height. | ||
* Only works if `position` is `fixed` and `usePortal` is true. | ||
*/ | ||
position: 'static' | 'sticky'; |
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.
Just so I understand this correct, options are:
{
position: 'static' | 'sticky'
}
or
{
position: 'fixed',
usePortal: ...,
insert: ...,
affordForDisplacement: ...,
}
i.e. just adding insert
to position: fixed
? Are there any combinations that worked previously but don't with this change?
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.
Nice catch! I wrote this a little wrong, I've rewritten this interface and I'm afraid it's going to be a breaking change, because usePortal
was true
by default, and now it's false
. It used to apply only to fixed
position, but now it can apply to all positions, so if we leave it true
, we will have not expected behavior for others by default.
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.
I think that given the same code before and after this change, if the functionality remains consistent, we shouldn't consider it breaking. I.e. if I don't specify usePortal
before and after this change, it should look and function the same, and that should be fine.
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.
I see what you mean. The point is that we had usePortal
and affordForDisplacement
as defaults true
and now they are false
, this change leads to different behavior if these properties were not explicitly specified. This PR in itself is breaking because we allow BottomBar of any position type to be portable, which means that the behavior that was the default for fixed position should apply to other types, but in order to avoid not-expected behavior when using BottomBar, we need to remove some defaults and specify them ourselves if needed
d93e30b
to
661f108
Compare
3b497a0
to
f371264
Compare
@BSFishy Are you happy with where this landed? |
My concern with this PR is that it was meant to go into Dashboards but I believe it's breaking. @SergeyMyssak can confirm if that's the case. I spun up a Dashboards instance with this change and went to Stack Management and changed some settings to see the bottom bar, and nothing seemed to have broken, but if there's a chance that someone will break because of this, I don't want to put it into the 1.x line. |
05b6ac0
to
ac5568d
Compare
In the Dashboards, we have BottomBar in 3 places:
The changes only concern the default values |
Co-authored-by: Andrey Myssak <[email protected]> Signed-off-by: Sergey Myssak <[email protected]>
Co-authored-by: Andrey Myssak <[email protected]> Signed-off-by: Sergey Myssak <[email protected]>
ac5568d
to
cf5351b
Compare
Co-authored-by: Andrey Myssak <[email protected]> Signed-off-by: Sergey Myssak <[email protected]>
cf5351b
to
30054ad
Compare
…ement Signed-off-by: Josh Romero <[email protected]>
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.
New test suite passes. I think we can consider this something like "clarifying previously ambiguous functionality/requirements" based on #758 (comment)
Description
Allow to portale BottomBar to any referenced DOM element
Issues Resolved
#707
Check List
yarn lint
yarn test-unit
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.