Skip to content
This repository has been archived by the owner. 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 commented Apr 24, 2017

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Fix #7930
  • Auditors: @luixxiul

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)
@cezaraugusto cezaraugusto added this to the 0.15.1 milestone Apr 24, 2017
@cezaraugusto cezaraugusto requested review from luixxiul and bradleyrichter Apr 24, 2017
@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
Member

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

cezaraugusto commented Apr 24, 2017

@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

cezaraugusto commented Apr 24, 2017

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

@jonathansampson
Copy link
Collaborator

jonathansampson commented Apr 24, 2017

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)',

This comment has been minimized.

Copy link
@luixxiul

luixxiul Apr 25, 2017

Contributor

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)',

This comment has been minimized.

Copy link
@luixxiul

luixxiul Apr 25, 2017

Contributor

ditto.

@bradleyrichter
Copy link
Contributor

bradleyrichter commented Apr 25, 2017

@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 Apr 26, 2017
@cezaraugusto
Copy link
Contributor Author

cezaraugusto commented Apr 26, 2017

Updated, set a smaller size and migrated scroll to body

@luixxiul
Copy link
Contributor

luixxiul commented Apr 26, 2017

Isn't the scroll bar too low contrasted?

@cezaraugusto
Copy link
Contributor Author

cezaraugusto commented Apr 26, 2017

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 left a comment

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',

This comment has been minimized.

Copy link
@luixxiul

luixxiul Apr 27, 2017

Contributor

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

This comment has been minimized.

Copy link
@jonathansampson

jonathansampson Apr 27, 2017

Collaborator

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?

This comment has been minimized.

Copy link
@cezaraugusto

cezaraugusto Apr 27, 2017

Author Contributor

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'

This comment has been minimized.

Copy link
@luixxiul

luixxiul Apr 27, 2017

Contributor

ditto

Copy link
Contributor

bradleyrichter left a comment

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 force-pushed the common/dialog/7930 branch from 633987e to 8da5411 Apr 28, 2017
- Fix #7930
- Auditors: @luixxiul
@cezaraugusto cezaraugusto reopened this Apr 28, 2017
@cezaraugusto
Copy link
Contributor Author

cezaraugusto commented Apr 28, 2017

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',

This comment has been minimized.

Copy link
@cezaraugusto

cezaraugusto Apr 28, 2017

Author Contributor

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

@jonathansampson
Copy link
Collaborator

jonathansampson commented Apr 28, 2017

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

@cezaraugusto cezaraugusto merged commit 1ebea19 into master Apr 28, 2017
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@cezaraugusto cezaraugusto deleted the common/dialog/7930 branch Apr 28, 2017
Copy link
Member

bsclifton left a comment

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

@luixxiul luixxiul removed the request for review from NejcZdovc Sep 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.