-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Overlay] New Overlay CSS plays nice with centered, scrollable dialogs #1373
Conversation
revert changes to Overlay, fix test, use rAF for popover focus logic
mostly reducing duplication!
Fix Sass lintingPreview: documentation |
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.
Code looks good to me.
@cmslewis Hmm, what browser? I can't repro on Chrome nor Firefox |
Disable text selection on backdropPreview: documentation |
Even out toast margin / toast container paddingPreview: documentation |
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.
looks good, we did a great job here! ✋
a few little cleanups and should be good to go
} | ||
|
||
private cancelContextMenu = (e: React.SyntheticEvent<HTMLDivElement>) => e.preventDefault(); | ||
|
||
private handleBackdropContextMenu = (e: React.MouseEvent<HTMLDivElement>) => { | ||
// HACKHACK: React function to remove from the event pool (not sure why it's not in typings #66) | ||
(e as any).persist(); | ||
// HACKHACK: React function to remove from the event pool |
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.
actually this is not a HACKHACK, it's expected usage if you want to use an event in a callback. can you remove the HACKHACK keyword but leave the rest of comment?
z-index: $pt-z-index-overlay; | ||
// add bottom margin for overflow scrolling scenarios | ||
margin-bottom: $pt-grid-size * 2; | ||
margin: ($pt-grid-size * 3) 0; |
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.
$dialog-margin
please
<div className={classNames(Classes.DIALOG, this.props.className)} style={this.props.style}> | ||
{this.maybeRenderHeader()} | ||
{this.props.children} | ||
<div className="pt-dialog-container"> |
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.
Classes.DIALOG_CONTAINER
@@ -56,4 +56,4 @@ and we'll take care of the rest. | |||
<Overlay className="pt-overlay-scroll-container" ... /> | |||
``` | |||
|
|||
The `Dialog` component does this automatically internally, except when it is used `inline`. | |||
The `Dialog` component applies this CSS class automatically internally. |
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.
remove word "internally"
ref={this.refHandlers.container} | ||
> | ||
{transitionGroup} | ||
</span> |
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 be safe to undo this formatting, nothing actually changed here.
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.
Much easier to parse next to the corresponding else
block right after, don't you think?
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.
can't see that other block in the default diff here but you're right
@@ -120,6 +120,10 @@ $popover-width: $pt-grid-size * 35 !default; | |||
.pt-transition-container { | |||
@include popover-inline-position(); | |||
} | |||
|
|||
.pt-overlay-inline { |
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.
can you add a comment why this is necessary? so we don't come wondering later. might require re-deriving why we had to add this.
Address nits and commentsPreview: documentation |
Address nits and commentsPreview: documentation |
@adidahiya I suppose you opened the dialog and then hovered the primary button to view the tooltip? In that case, yes it's expected. Separate bug, there's a fix in review now: #1369 |
@adidahiya @llorca: just merged master with fix for background scrolling. hopefully that'll work as expected now. edit: confirmed works @adidahiya please continue reviewing for potential workspace breaks! |
Merge branch 'master' of github.com:palantir/blueprint into al/dialog-flexPreview: documentation |
revert padding/margin changes for legacy compatPreview: documentation |
@adidahiya tested with multiple different versions of blueprint CSS and fixed a few loose ends. the new styles now include a small patch to reset |
actually hold up we can let the old version provide the old transitionsPreview: documentation |
…r scrolling requires re-implementing canOutsideClickClose but it's just dead simple fixes #1313
4e5e9c9 🏆 🥇 |
replace pointer-events with user-select on dialog to support container scrollingPreview: documentation |
99aa5c6
to
6e0177a
Compare
add .pt-dialog-container to markup example, remove custom docs section stylePreview: documentation |
|
||
private handleContainerClick = (evt: React.MouseEvent<HTMLDivElement>) => { | ||
// quick re-implementation of canOutsideClickClose because .pt-dialog-container covers the backdrop | ||
if (this.props.canOutsideClickClose && evt.currentTarget.closest(`.${Classes.DIALOG}`) == null) { |
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 the second part of the boolean condition here will always be true because currentTarget
is .pt-dialog-container
... I think you want evt.target
instead
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.
currentTarget should be container. i'm testing that the click did not come from within the .pt-dialog
, meaning it came from the .pt-dialog-container
itself.
you're completely right, i blew it ❌
fix isClickOutsideDialog logicPreview: documentation |
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.
why mousedown instead of click?
also you have a merge conflict
it's always been mousedown for "outside click." there was an old bug with click where you could move the mouse around while holding it down and do weird things. |
@adidahiya the real backdrop in |
Merge branch 'master' into al/dialog-flexPreview: documentation |
// LEGACY: override old (<= 1.24.0) dialog styles when inside a container to respect flex layout | ||
.pt-dialog { | ||
// stylelint-disable-next-line declaration-no-important | ||
position: static !important; |
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.
Hey can this be reasonably removed? This is some pretty wicked styling to overcome if you don't want your dialog to be in the center of the screen.
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.
@kmwhelan93 please file a new issue to discuss this. nearly lost this comment to the sands of time. also note that we're working on 3.0 on develop
, while this PR is way back in the 1.x days.
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.
@kmwhelan93 or even better, hit me with a PR and a passing build! ✅
Fixes #552, Fixes #1240, Fixes #1313
Checklist
Reviewers should focus on:
What happened
Dialog
component now renders a.pt-dialog-container
wrapper as its root element which centers the.pt-dialog
in a viewport-covering flex container. This provides super reliable centering behavior (#552) and much improved scrolling support (though some issues are still present like #1008).