Align calendar week view
Categories
(Calendar :: Calendar Frontend, enhancement)
Tracking
(thunderbird_esr78 unaffected)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | unaffected |
People
(Reporter: adrien.rybarczyk, Assigned: Paenglab)
Details
Attachments
(2 files, 2 obsolete files)
1.35 KB,
image/png
|
Details | |
1.89 KB,
patch
|
Paenglab
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Steps to reproduce:
Be in weekly view.
Actual results:
There is an offset pixel on the alignment.
Bug present in 78 and 90 but the offset is not the same.
Expected results:
The elements are aligned.
Comment hidden (off-topic) |
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
This comes because the width of headerscrollbarspacer
and labelscrollbarspacer
are set 1px wider than the scrollbar width is. Tested on Linux and Windows.
Henry, do you know what could be wrong when the width is calculated here: https://searchfox.org/comm-central/rev/c821090d64c92a05bfc49aba6d5f0d25ad5ff52e/calendar/base/content/calendar-multiday-view.js#1934 ?
Assignee | ||
Comment 3•3 years ago
|
||
I found the issue: we set a margin here https://searchfox.org/comm-central/rev/c821090d64c92a05bfc49aba6d5f0d25ad5ff52e/calendar/base/themes/common/calendar-views.css#558.
Does a function exist that includes in the calculation the margins or do we need to add this margin manually?
Comment 4•3 years ago
|
||
(In reply to Richard Marti (:Paenglab) from comment #3)
Does a function exist that includes in the calculation the margins or do we need to add this margin manually?
getBoundingClientRect
only returns the border area, you have to add the margin yourself.
This issue should get fixed as a side effect once I get round to Bug 1713130. If this isn't a huge priority to fix soon, you can add the dependency.
Assignee | ||
Comment 5•3 years ago
|
||
Is Bug 1713130 planned to land on TB 91? If not, I'll fix this here.
Comment 6•3 years ago
|
||
I've not got any specific release plan, so go ahead and fix this here
Assignee | ||
Comment 7•3 years ago
|
||
Is this okay like this? I have only basic JS knowledge. So propose a smarter way if where is one.
Comment 8•3 years ago
|
||
Comment on attachment 9230327 [details] [diff] [review] 1719645-weekView-scrollbar-width.patch Review of attachment 9230327 [details] [diff] [review]: ----------------------------------------------------------------- ::: calendar/base/content/calendar-multiday-view.js @@ +1950,5 @@ > + // We need to include in our calculation the 1px margin-end of the > + // calendar-time-bar[orient="vertical"] > + if (this.getAttribute("orient") == "vertical") { > + scrollbarSize = scrollbar - 1; > + } Since `scrollboxSize` and `scrollbar` are only used once, you can tidy up by dropping them and just using a non-const `scrollbarSize`. To be on the safer side, instead of manually reducing by 1 pixel, when you compute the scrollboxChildrenSize above, you could use let computedStyle = window.getComputedStyle(child); if (this.getAttribute("orient") == "vertical") { scrollboxChildrenSize += parseFloat(computedStyle.marginLeft); scrollboxChildrenSize += parseFloat(computedStyle.marginRight); } else { scrollboxChildrenSize += parseFloat(computedStyle.marginTop); scrollboxChildrenSize += parseFloat(computedStyle.marginBottom); } This way, if the margin changes to some other px value, this method won't break. Some disclaimers though, the parseFloat is needed because the computedStyle will return the string value, e.g. "1px", so it will ignore the trailing "px". This means that it will break if the margin is set to a non-px value, like "3em" or "auto", and in the latter case you'll have a NaN. So to be extra safe, you could check each computed value against the regular expression /^[0-9]+(\.[0-9]+\)?px$/ first.
Assignee | ||
Comment 9•3 years ago
|
||
I think because we do the styling in our files we don't need to check with regex.
Comment 10•3 years ago
|
||
Comment on attachment 9230339 [details] [diff] [review] 1719645-weekView-scrollbar-width.patch Review of attachment 9230339 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. I've not reviewed via splinter before (only on phabricator). I just set the review to `+` to accept it. Not sure if that was right.
Assignee | ||
Comment 11•3 years ago
|
||
(In reply to Henry Wilkes [:henry] from comment #10)
I just set the review to
+
to accept it. Not sure if that was right.
Yes, that was right.
Comment 12•3 years ago
|
||
Comment on attachment 9230339 [details] [diff] [review] 1719645-weekView-scrollbar-width.patch Review of attachment 9230339 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. I've not reviewed via splinter before (only on phabricator). I just set the review to `+` to accept it. Not sure if that was right. ::: calendar/base/content/calendar-multiday-view.js @@ +1939,5 @@ > // we subtract the size of the other scrollbox children from the size of the scrollbox > // to calculate the size of the scrollbar. > let scrollboxChildrenSize = 0; > for (const child of this.scrollbox.children) { > + let computedStyle = window.getComputedStyle(child); Maybe add a comment to explain that we expect the margin to be set to a px value, so future people will be aware of the assumption.
Assignee | ||
Comment 13•3 years ago
|
||
Added a comment that we expect px.
Comment 14•3 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/fc94169f2fda
In week view set the correct scrollbar width for the spacers. r=henry
Description
•