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

Sidebar panels added by plugins may inherit styles from WordPress that should be reset #8616

Closed
afercia opened this issue Aug 6, 2018 · 8 comments
Labels
[Type] Enhancement A suggestion for improvement.

Comments

@afercia
Copy link
Contributor

afercia commented Aug 6, 2018

Noticed while working on #8554 /Cc @jasmussen

Seems that sidebar panels added by plugin may inherit (depending on their implementation) styles from WordPress that could lead to unexpected results.

For example, when using the Ctrl + backtick keyboard shortcut to navigate through the main regions, the focus style applied around the sidebar may look wrong:

screen shot 2018-08-06 at 19 27 58

See the last sidebar panel that overlaps the focus style. This specific panel uses some markup from the WordPress meta boxes. After a quick investigation, seems two position: relative CSS declarations are responsible for this:

from Gutenberg:

.edit-post-meta-boxes-area {
    position: relative;
}

from WordPress

.postbox {
    position: relative;
    ...

Potentially, there could be other inherited CSS rules that could produce unexpected results. Soem special care should be taken in overriding these rules for the panels in the sidebar.

@afercia afercia added the [Type] Enhancement A suggestion for improvement. label Aug 6, 2018
@jasmussen
Copy link
Contributor

Interesting indeed. I'd love to get rid of both relative positionings, but I also feel like there's a reason they're there.

Do "modern" sidebar metaboxes get these CSS classed wrappers as well, or is it only "legacy" metaboxes? I haven't been deep into the code for a while so I can't recall the details.

Would an added z-index: 0; fix this for plugins, or would that just make things worse?

If we can't remove the position relative, plan B might be to expand the region-focus-outline outwards instead of inwards, which wouldn't be as nice but could solve it. CC: @youknowriad because I recall you working on these classnames.

@youknowriad
Copy link
Contributor

I don't have any specific context to add at first sight. I don't recall any particular reason for the relative positioning.

@afercia
Copy link
Contributor Author

afercia commented Aug 7, 2018

Worth noting this happens only in combination with #8554 because it uses outline instead of box-shadow. An inset box-shadow is drawn on top of any other children, while the outline behaves differently.

I've just noticed that hovering the "Revisions" panels produces the same effect:

sidebar panel background

This happens because the "Revisions" panels (specifically the link icon-button within it) gets a white background only when hovered. So I've checked the panel added by the plugin and it does have a white background (set on the .postbox div). All the other panels don't have a background.

Seems the easier fix would be resetting these backgrounds?

@jasmussen
Copy link
Contributor

Hmm that's interesting — simply removing the background there does seem to fix the issue. But I wonder why that is? Would any other CSS properties cause it to shift upwards like that?

@afercia
Copy link
Contributor Author

afercia commented Aug 8, 2018

Well the background is set on a children of the element with outline, and the children has a higher stack index. That is. Box-shadow works differently.

@jasmussen
Copy link
Contributor

Right, but I'm wondering what makes the background property elevate this element. It also has borders and lots of other things, what makes those not elevate it?

@nerrad
Copy link
Contributor

nerrad commented Jun 2, 2019

@afercia is this issue still present? I'm don't seen the hover issue with the Revisions panel anymore.

@nerrad nerrad added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jun 2, 2019
@afercia
Copy link
Contributor Author

afercia commented Jun 2, 2019

@nerrad can't reproduce as well. I think this was fixed as a side effect of the navigate regions focus style in #8554.

@afercia afercia closed this as completed Jun 2, 2019
@afercia afercia removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants