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

Fixed z-index btn group hover/focus/active relative to reselect dropdown #1211

Merged
merged 3 commits into from
Aug 13, 2019

Conversation

iamgollum
Copy link
Contributor

@iamgollum iamgollum commented Jul 17, 2019

There is a general misunderstanding of the z-index Stacking Context

<div class="Select ... etc...   is-open  ...."> // Relative Position
   ... etc....
   <div Select-outer-menu /> ... dynamic
</div>

The following div will always be above the Select, no matter how high you set the z-index on the outer menu ....

<div class="two-sides-toggle-button btn-group"> // Relative Position, Z-Index: 2
   <button type="button" class="btn btn-default"><i class="fonticon-table"></i> Table</button>
  <button type="button" class="active btn btn-default">Metadata</button>
  <button type="button" class="btn btn-default"><i class="fonticon-json"></i> JSON</button>
</div>

The fix is to adjust the Z-index on the button effects: hover,focus,active.
You can also make the Select not-relative and redesign that component.

See #998 in the thread with the dropdown on the reselect component going underneath the btn group on effect.

Screen Shot 2019-07-16 at 6 07 22 PM

Copy link
Contributor

@Antonio-Maranhao Antonio-Maranhao left a comment

Choose a reason for hiding this comment

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

Great fix! Just one suggestion.

@@ -85,7 +84,7 @@
.btn-group > .btn:focus,
.btn-group > .btn:active,
.btn-group > .btn.active {
z-index: 2;
z-index: 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be better to set the z-index at https://github.com/apache/couchdb-fauxton/blob/master/assets/less/formstyles.less#L350 instead.
This way it's obvious what we are overriding whenever we upgrade bootstrap.

Copy link
Contributor Author

@iamgollum iamgollum Jul 17, 2019

Choose a reason for hiding this comment

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

@Antonio-Maranhao sounds good. I will start keeping that in mind. I will do this tonight! In addition, targeting specifically active as you suggested is definitely scoped to perfection for this bug.

Copy link
Contributor Author

@iamgollum iamgollum Jul 17, 2019

Choose a reason for hiding this comment

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

@Antonio-Maranhao required a !important since bootstrap took hire precedence with more focused scope. Based on specificity: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity ... its okay practice in this case to use it since Bootstrap is a "3rd party" stylesheet. My original fix, I didn't even realize it was in the Bootstrap folder ...now I know what you meant by Bootstrap...I wasn't thinking!

}
&.active {
z-index: 1 !important;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be relevant to add a comment here to justify the !important

Copy link
Contributor Author

@iamgollum iamgollum Jul 19, 2019

Choose a reason for hiding this comment

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

@popojargo let me know what you think. Added explanation.

@Antonio-Maranhao Antonio-Maranhao merged commit 237763d into apache:master Aug 13, 2019
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