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

Fix "Insert Header" Toolbar Button Responsive Styling #9342

Closed
noi5e opened this issue Mar 21, 2021 · 3 comments · Fixed by #9343
Closed

Fix "Insert Header" Toolbar Button Responsive Styling #9342

noi5e opened this issue Mar 21, 2021 · 3 comments · Fixed by #9343
Assignees
Labels
CSS easy feature explains that the issue is to add a new feature help wanted requires help by anyone willing to contribute

Comments

@noi5e
Copy link
Contributor

noi5e commented Mar 21, 2021

In the legacy editor, the "Insert Header" toolbar button's icon completely disappears when you resize the window.
Specifically, if the window's width is greater than 700px and less than 1000px.

Video

(The Header button is the H in the video below)

Screen.Recording.2021-03-20.at.8.33.22.PM.mov

How to Reproduce

Go to any place that uses the legacy editor on our site. This includes notes, wikis, and questions.
It also includes /wiki/new.

  1. For example, go to this note on our testing server at stable.
  2. Resize the window as above, and notice how the H disappears.

Suggested Fixes

You'll have to do some research in the codebase and the CSS stylesheets.

The partial for the toolbar is at /app/views/editor/_toolbar.html.erb:

<a
id="header-button-<%= toolbar_element_id %>"
title="Header"
data-action="h2"
<%# to setState on editor.js %>
data-form-id="<%= toolbar_element_id %>"
data-placement="bottom"
data-toggle="tooltip"
class="header-button btn btn-outline-secondary btn-sm rich-text-button"
>
<b>
<span class="d-md-none d-lg-inline">
<i class="fa fa-header"></i>
</span>
</b>
</a>

I notice that the icon is wrapped in a span with class d-md-none, so that might be it. But definitely play around with this and see what you find!

This is a great issue for someone who just completed an FTO and wants something a little more challenging.

Post a comment here to claim this issue, and afterward, feel free to post a comment asking for help if you get stuck!

@noi5e noi5e added help wanted requires help by anyone willing to contribute feature explains that the issue is to add a new feature CSS easy labels Mar 21, 2021
@waridrox
Copy link
Member

waridrox commented Mar 21, 2021

Can I try it please ? @noi5e

@noi5e
Copy link
Contributor Author

noi5e commented Mar 21, 2021

@waridrox Nice, that was fast! Go ahead, just post a comment here if you get stuck.

@waridrox
Copy link
Member

You know what they say - sometimes the answer is right in front of you...

<a
id="header-button-<%= toolbar_element_id %>"
title="Header"
data-action="h2"
<%# to setState on editor.js %>
data-form-id="<%= toolbar_element_id %>"
data-placement="bottom"
data-toggle="tooltip"
class="header-button btn btn-outline-secondary btn-sm rich-text-button"
>
<b>
<span class="d-md-none d-lg-inline">
<i class="fa fa-header"></i>
</span>
</b>

In this case, code at line 40 was applying an unnecessary span element which was conflicting with the styles. Removing that simply resolved the issue :D

No functionality is hindered after the change though a lot of time went into finding this 😅

Functionality.mp4

I've reverted back the colors, they were just for debugging purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS easy feature explains that the issue is to add a new feature help wanted requires help by anyone willing to contribute
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants