-
Notifications
You must be signed in to change notification settings - Fork 49
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: modify calculation for dialog defaultWidth which caused visual bug #133
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.
Just left a nit. @julien will know better the impact of this change :)
var defaultWidth = size.width * 0.5 - 10; | ||
var padding = 40; | ||
|
||
var defaultWidth = size.width * 0.5 - padding; |
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.
Is this padding
var being used elsewhere? If not I'd avoid creating the variable
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.
you're right, it's not being used anywhere, but I'm guessing @mateomustapic added this to avoid a "magic number"
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.
Is not 0.5 already a magic number? 😛
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.
Well, it translates pretty obviously to "half" so not all that magical, unlike padding
which is totally arbitrary. You probably wouldn't want to write:
var padding = 40;
var half = 0.5;
var defaultWidth = size.width * half - padding;
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.
Is not 0.5 already a magic number? stuck_out_tongue
yeah, well you make a point; but I always read that as "whatever / 2"
x / 2 == x * 0.5
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.
Sorry I hadn't seen @wincent 's comment before adding mine: now that I've read it, I agree about avoiding those magic numbers everywhere
gonna test this right now 🥳 |
@mateomustapic so I tested this and here's what I think (with screenshots): The bug seems to be gone in Chrome: and also seems fixed when you have the devtools open or if the window has a smaller size: Same thing, in Firefox: And in Firefox with the devtools open: But while we're looking at it, I also would consider fixing this, because it seems related (I'm not saying it's mandatory but if it's not too hard to fix, why not) |
@mateomustapic concerning the editor's height in the dialog, I'm going to to that in #132 |
hey @julien Just tested this in IE, and works as in other browsers. |
Ok thanks for confirming @mateomustapic, I'm still going to give it a quick test run in DXP because who knows. Could you tell me what you think of @wincent's comment? I personally think it's better to avoid those magic numbers, so I'd be OK to do it both for @carloslancha does that seem reasonable to you as well? |
@julien As I can see, @wincent says |
I need to wear glasses |
Why don't simply use That's more obviously a "halving" operation than |
@jbalsas that's also true - even more obvious |
yeah, it's more readable to divide by 2 than multiply 0.5. |
9a9a316
to
cb2190f
Compare
The change looks good to me - so I'm merging this one |
This PR fixes an issue described in https://issues.liferay.com/browse/LPS-120758 ,visual bug in
Chrome
(scrollbar) and inFirefox
(whitespace) in Source dialog box.This issue was caused by
CodeMirror
plugin line number width not included in dialog size calculation.To test this fix:
Before Chrome
Before Firefox
After Chrome
After Firefox