Skip to content
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

Work around getComputedStyle bug in Firefox #342

Merged
merged 3 commits into from
Apr 5, 2017

Conversation

robertknight
Copy link
Member

@robertknight robertknight commented Apr 5, 2017

<thread-list> uses getComputedStyle to find the nearest scrollable
ancestor element which it needs to know in order to scroll specific
annotations into view and determine which annotations are visible.

In Firefox getComputedStyle may return null if the iframe is hidden which may be the case when this code is called in the sidebar. This is considered a bug upstream. Work around it in the meantime by adding a specific class to the scrollable element and testing for that as a fallback instead.

Fixes #341

`<thread-list>` uses `getComputedStyle` to find the nearest scrollable
ancestor element which it needs to know in order to scroll specific
annotations into view and determine which annotations are visible.

In Firefox `getComputedStyle` may return `null` if the iframe is hidden
- which may be the case when this code is called in the sidebar.  This
is considered a bug upstream. Work around it in the meantime by adding a
specific class (`js-scrollable`) to the scrollable element and testing
for that as a fallback.

Fixes #341
@codecov-io
Copy link

codecov-io commented Apr 5, 2017

Codecov Report

Merging #342 into master will decrease coverage by 0.04%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #342      +/-   ##
==========================================
- Coverage   76.55%   76.51%   -0.05%     
==========================================
  Files         120      120              
  Lines        5946     5940       -6     
  Branches      964      964              
==========================================
- Hits         4552     4545       -7     
- Misses       1394     1395       +1
Impacted Files Coverage Δ
src/sidebar/components/thread-list.js 62% <25%> (-5.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a48ef19...3e291d0. Read the comment docs.

Currently the app only ever has one `<thread-list>` instance, so
we can simplify the logic that gets the scroll root to just query for a
hard-coded selector.
This could return `null` in Firefox when the sidebar iframe is hidden.
@seanh seanh self-assigned this Apr 5, 2017
@seanh
Copy link
Contributor

seanh commented Apr 5, 2017

Works for me, and I think the new code is better as well (I'm not sure I understand the future use case that finding the nearest scrollable element was trying to support)

@seanh seanh merged commit 42cbbdd into master Apr 5, 2017
@seanh seanh deleted the work-around-firefox-getcomputedstyle branch April 5, 2017 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants