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

Fix popover flyout issue #1637

Conversation

Blackbaud-StacyCarlos
Copy link
Contributor

@Blackbaud-StacyCarlos Blackbaud-StacyCarlos commented Apr 17, 2018

This incorporates a fix for #1636.

The use of getBoundingClientRect is fine, but the resulting top, bottom, right, and left are not based on the offsetParent of the original element.

When specifying left and top of a positioned element, we must ensure we compensate for the position of the first positioned ancestor, i.e. offsetParent, if you want to to line up with other siblings. Originally, the was solved by appending to body, but the change in design warrants this fix.

Rather than adding logic to determine offset parent, I have opted to remove styling that forces offset parents for fixed elements.

However, I do believe many of these components are fundamentally flawed in how they were implemented. The reuse of the entire dropdown component, rather than a simple popover or dropdown menu component, was good as a base, but should be refactored out to increase maintainability and readability.


The plunkr for Flyouts is currently broken, but this is where the issue can be seen.

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 23b6796
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/367794472

(Please note that this is a fully automated comment.)

@codecov-io
Copy link

codecov-io commented Apr 23, 2018

Codecov Report

Merging #1637 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1637   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files         395      395           
  Lines        8110     8110           
  Branches     1196     1196           
=======================================
  Hits         8109     8109           
  Misses          1        1
Impacted Files Coverage Δ
src/modules/flyout/flyout.component.ts 100% <ø> (ø) ⬆️

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 349a5d4...b411887. Read the comment docs.

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: b5f0db0
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/370238015

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 1bd9343
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/370284744

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 7391c46
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/370287485

(Please note that this is a fully automated comment.)

@Blackbaud-StacyCarlos Blackbaud-StacyCarlos changed the title Added offsetParent into popover postition calculation Fix popover flyout issue / Dropdown usage refactor Apr 24, 2018
@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 680e59f
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/370357793

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 25df94a
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/370391169

(Please note that this is a fully automated comment.)

@@ -44,7 +44,7 @@ const FLYOUT_CLOSED_STATE = 'flyoutClosed';
styleUrls: ['./flyout.component.scss'],
animations: [
trigger('flyoutState', [
state(FLYOUT_OPEN_STATE, style({ transform: 'translateX(0)' })),
state(FLYOUT_OPEN_STATE, style({ transform: 'inherit' })),

Choose a reason for hiding this comment

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

@Blackbaud-StacyCarlos Thanks for the pull request. While I think your other changes could be helpful, as it stands, I only added this change to master branch and the dropdowns worked. Can you explain the research that went into this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main aspect that I used to fix this came from the fact that popovers are all fixed elements. Fixed elements don't, or rather should not, have an offsetParent. Despite that, the popover was behaving as if it was absolute positioned inside the flyout.

With that knowledge I knew that some styling of the flyout must have been causing this. I immediately realized it was the transform. The transform styling creates a stacking context which pretty much means that everything within it is treated like one big unit so that it will move together based on your specifications. Honestly, it should probably be set to initial instead of inherit, but I was just thinking of some random cases at the time.

Does that help?

Choose a reason for hiding this comment

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

@Blackbaud-StacyCarlos Thanks for the in-depth reply; certainly helps (I can confirm that initial also works).

Now that we know this minimal change fixes the respective issue, I'm leaning toward pulling this single change out into a new pull request and keeping the other, more involved changes in this branch for future consideration.

It would also be nice to add a simple dropdown to the Flyout's visual test, since this behavior is primarily visual.

Thoughts on that? If we do it that way, we can probably merge and release this fix much quicker. (I'm also happy to do this for you, if you do not have spare time.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do this immediately after I get back from lunch.

Choose a reason for hiding this comment

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

Perfect. Thank you!

Copy link
Contributor Author

@Blackbaud-StacyCarlos Blackbaud-StacyCarlos May 7, 2018

Choose a reason for hiding this comment

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

@Blackbaud-SteveBrush Sorry for the delay. I have separated the pull requests and added an appropriate visual test.

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 8037df2
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/374918944

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: f3e495d
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/374993149

(Please note that this is a fully automated comment.)

@Blackbaud-StacyCarlos Blackbaud-StacyCarlos changed the title Fix popover flyout issue / Dropdown usage refactor Fix popover flyout issue May 7, 2018
@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 97652d3
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/375943489

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: b411887
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/375943591

(Please note that this is a fully automated comment.)

@Blackbaud-SteveBrush Blackbaud-SteveBrush merged commit ef575b7 into blackbaud:master May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants