-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Theme: remove nested anchor in theme sheet #34695
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~6 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
client/my-sites/theme/main.jsx
Outdated
</span> | ||
</a> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "Open Live Demo" button seems to be a part of intentional UI design that looks differently on wide two-column layout and narrow, mobile one-column layout
- two-column layout shows an "Open Live Demo" item in a
SectionNav
in the left column - that item is hidden in one-column view, and the "Open Live Demo" button (the element being removed in this PR) is displayed under the screenshot
@folletto may provide some advice about how to remove the invalid HTML while keeping the design working. He originally worked on it and submitted PRs like #13598.
Also, removing the button breaks the theme-sheet-welcome-tour
guided tour that looks for the data-tip-target="theme-sheet-preview"
element and attaches a bubble to it. That tour is likely already broken on non-mobile views (?!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To see this code in action, open a theme page like https://wordpress.com/theme/modern-business and resize the window to switch between one- and two-column views.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so that's why it was there. We should include a comment in the fix so it's more apparent.
Maybe I'm missing something, but... where? Can you post a screenshot? |
Ah! I think I connected the pieces of the puzzle of why you pointed that out. Sorry, and thanks :D Yes. The page uses some tricky pieces of code in order to make the two button appear at different breakpoints (mobile/desktop) so it's not hidden, it's just hidden at that breakpoint. It's not elegant, and frankly I don't recall the reasons from the depth of 2017, just it was the way we found to avoid other issues. I think it's because popping in and out a button from the bar at the top and move it below the screenshot, wasn't really trivial to do. |
I'm not sure if current implementation of NavSection supports inlined right-alined button but I think we can improve current design of the theme sheet page by turning "Open Live Demo" into a button that remains in-place even in mobile view. As to why, it's not really a NavItem but a button and it could use more emphasis. This is what I had in mind. "Open Live Demo" should look more like a button than just a rectangle but this is best I can manage in short time. What do you think? |
I'm ok if you want to switch placement of it. The above however seems going a bit more outside the UI patterns we have right now, no? Is there another example of such layout that I'm missing? |
@folletto we use a similar layout on the "Plugins" screen: But the buttons are not part of the @donpark If we want to just fix the non-valid HTML markup (nested |
That's a bit different from the above. I'm ok with going for something like Plugins if y'all prefer to go for that layout :) I agree right now is probably better to just fix the nesting. |
Yeah, I agree that just fixing the nesting makes more sense. I'll update this PR. Thx. |
I just noticed a thing on the mobile screenshot: the gradient is wrong. :D It's not super noticeable on that theme given the image cut, but on another: This is fixed: It might have been when the color variables were introduced, this slipped through.
This should fix it (but I haven't checked if it has consequences elsewhere):
|
Done. Button border looked more vulnerable as result but darkening it didn't help much so I let it alone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great now, both the button and the gradient. Thanks for working on this! 👍
Changes proposed in this Pull Request
Removes unnecessary 'Open Live Demo' anchor nested inside preview anchor in theme sheet page at
/theme/{theme_slug}
path.Nested anchor was not visible and is no longer necessary because 'Open Live Demo' button is already displayed in the Nav Bar.
Testing instructions
/theme/photo-blog
or/theme/photo-blog/{site_slug}
.Fixes #34609