Skip to content

Commit

Permalink
Absolute positioned checkboxes overlay floated elements (#26870) (#27366
Browse files Browse the repository at this point in the history
)

Backport #26870 by @rafh

Currently, checkboxes are positioned as absolute. This positioning
causes the input to overlay an element that has been floated within the
editor. Floated elements are useful if you want your text to wrap around
this element. This PR fixes the overlaying of checkboxes by removing the
absolute positioning, updating the `ul` padding, and
displaying`.task-list-item` `flex` to ensure inputs and the associated
label are on the same line.

Screenshots:

Before:
<img width="762" alt="Screenshot 2023-09-01 at 3 40 59 PM"
src="https://github.com/go-gitea/gitea/assets/6152817/570247c7-7f5c-4697-bfc9-ad4655e37991">

After:
<img width="762" alt="Screenshot 2023-09-01 at 3 42 20 PM"
src="https://github.com/go-gitea/gitea/assets/6152817/db53df45-1294-4eee-84c0-b21ac4fdf805">

Co-authored-by: Rafael Heard <[email protected]>
Co-authored-by: rafh <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2023
1 parent 006c15f commit 79c17d8
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions web_src/css/markup/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,29 @@

.markup .task-list-item {
list-style-type: none;
position: relative;
line-height: 1.5rem;
min-height: 1.5rem; /* // to render a checkbox list without content `- [ ]`, we need this min-height to make sure the <li> can be visible */
}

.markup .task-list-item p + ul {
margin-top: 16px;
}

.markup .task-list-item input[type="checkbox"] {
position: absolute;
top: 0.25em;
left: -1.6em;
margin: 0 .3em .25em -1.4em;
vertical-align: middle;
padding: 0;
}

.markup .task-list-item input[type="checkbox"] + p {
margin-left: -0.2em;
display: inline;
}

.markup .task-list-item p {
line-height: 1.5rem;
.markup .task-list-item > p {
margin-inline: 16px;
}

.markup .task-list-item + .task-list-item {
margin-top: 3px;
margin-top: 4px;
}

.markup input[type="checkbox"] {
Expand Down Expand Up @@ -327,7 +333,7 @@

.markup img[align="left"],
.markup video[align="left"] {
padding-right: 20px;
padding-right: 28px;
}

.markup .emoji {
Expand Down

0 comments on commit 79c17d8

Please sign in to comment.