Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

prevent Dialog from being uncloseable with long text #8475

Merged
merged 2 commits into from
Apr 28, 2017

Conversation

cezaraugusto
Copy link
Contributor

@cezaraugusto cezaraugusto commented Apr 24, 2017

Screenshot:
screen shot 2017-04-28 at 1 59 30 am
screen shot 2017-04-28 at 2 00 12 am

Note: no scrollbar is shown because I have it hidden by default in macOS. It's set as default so each OS will render native scrollbars (per Brad #8475 (review))

/cc @bradleyrichter for design review

Test Plan:

  1. Open https://jsfiddle.net/c5o7arqu/
  2. Make the browser window small
  3. Click "OK"
  4. Scrollbar should show, text should be scrollable
  5. Remove some text with devTools or open a smaller dialog
  6. Scrollbar shouldn't show
  7. everything should be properly aligned
  8. Resizing screen should resize dialog as well (responsive)

@jonathansampson
Copy link
Collaborator

jonathansampson commented Apr 24, 2017

@cezaraugusto @bradleyrichter Can we consider making only the body text scrollable (when it hits a max-height), so the dialog button is always visible? Making the user scroll down to dismiss the dialog seems unnecessary.

@NejcZdovc
Copy link
Contributor

NejcZdovc commented Apr 24, 2017

Personally I wouldn't go with a full width (90%), but limit it to I don't know maybe max 300, 400px (completely random number from the top of my head 😃 )

@cezaraugusto
Copy link
Contributor Author

@jonathansampson that's a great idea. I'll wait for design feedback from Brad and do all together, thanks for reviewing

@cezaraugusto
Copy link
Contributor Author

@NejcZdovc thanks, yep I did a random guess as well

@jonathansampson
Copy link
Collaborator

Agree with @NejcZdovc that we need a max-width, or a fixed-width.

@luixxiul
Copy link
Contributor

luixxiul commented Apr 25, 2017

+1 unless the title could be so long that it would overflow the dialog.

'::-webkit-scrollbar-thumb': {
background: globalStyles.color.braveOrange,
// same as primary button
boxShadow: '0px 1px 5px -1px rgba(0, 0, 0, 0.5)',
Copy link
Contributor

Choose a reason for hiding this comment

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

let's replace the box-shadow with a variable on global.js for future use :-)

borderRadius: '4px'
},
'::-webkit-scrollbar-track': {
boxShadow: 'inset 0 0 4px rgba(0,0,0, 0.3)',
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

@bradleyrichter
Copy link
Contributor

bradleyrichter commented Apr 25, 2017 via email

@cezaraugusto cezaraugusto self-assigned this Apr 26, 2017
@cezaraugusto cezaraugusto force-pushed the common/dialog/7930 branch 2 times, most recently from 771c65c to 633987e Compare April 26, 2017 09:42
@cezaraugusto
Copy link
Contributor Author

Updated, set a smaller size and migrated scroll to body

@luixxiul
Copy link
Contributor

Isn't the scroll bar too low contrasted?

@cezaraugusto
Copy link
Contributor Author

contrast looks good for me but I don't mind changing it

@jonathansampson
Copy link
Collaborator

jonathansampson commented Apr 27, 2017

@cezaraugusto Looks really great! Can we do anything about making sure it isn't taller than the window?

lengthy-dialog4

lengthy-dialog3

Copy link
Collaborator

@jonathansampson jonathansampson left a comment

Choose a reason for hiding this comment

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

Everything looks good, and works well. I had one suggestion to further improve, but I still think this is ship-ready.

@@ -154,7 +158,10 @@ const styles = StyleSheet.create({
marginTop: globalStyles.spacing.dialogInsideMargin,
minWidth: '425px',
marginBottom: globalStyles.spacing.dialogInsideMargin,
userSelect: 'text'
userSelect: 'text',
maxHeight: '300px',
Copy link
Contributor

@luixxiul luixxiul Apr 27, 2017

Choose a reason for hiding this comment

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

what if we would apply vh instead of px? 300px might be small for full HD monitors. Please see about:error page for examples.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, good idea @luixxiul with vh. Since dialogs are pretty much always sized and positioned relatively to the viewport, it makes sense to use vh and vw. What do you think, @cezaraugusto?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's great, I took a look at other browsers and they take that approach as well. Maybe 80vh is good enough?

// Issue #7930
boxSizing: 'border-box',
maxWidth: '600px',
maxHeight: '500px'
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

@bradleyrichter bradleyrichter left a comment

Choose a reason for hiding this comment

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

After some thought, I think it would be desirable to use the native scrollbar on each platform so that users recognize it as being a standard control used by the OS.

@cezaraugusto cezaraugusto reopened this Apr 28, 2017
@cezaraugusto
Copy link
Contributor Author

PR updated with custom scrollbar removal. New STR and preview here: #8475 (comment)

@@ -110,7 +110,7 @@ const globalStyles = {
buttonHeight: '25px',
buttonWidth: '25px',
navbarHeight: '36px',
downloadsBarHeight: '50px',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looking at the component and at variables.less it actually never was 50px

@jonathansampson
Copy link
Collaborator

Just pulled down the changes; beautiful work, @cezaraugusto!

@cezaraugusto cezaraugusto merged commit 1ebea19 into master Apr 28, 2017
@cezaraugusto cezaraugusto deleted the common/dialog/7930 branch April 28, 2017 23:37
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Awesome work, @cezaraugusto! This looks and feels great 😄

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

Successfully merging this pull request may close these issues.

6 participants