Skip to content

Allow text selection in markdown rendered checkbox labels #13942

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

Closed
wants to merge 1 commit into from

Conversation

j2L4e
Copy link

@j2L4e j2L4e commented Dec 11, 2020

Overrides Semantic UI styling of Checkbox labels to allow text selection in markdown rendered content.

fixes #12842

@silverwind
Copy link
Member

silverwind commented Dec 11, 2020

There is more to this than just allowing user-select. If one starts and ends a selection on such a label some of Fomantic's JS seems to unexpectedly clear the selection probably in an ill-fated attempt to toggle the checkbox. Maybe that bevhaviour can be fixed too, but I guess it would either require digging into fomantic options or layering another JS hack on top of it.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 11, 2020
@silverwind
Copy link
Member

silverwind commented Dec 11, 2020

A better fix is probably to remove the ui class (making fomantic no longer interfere) from those checkboxes and implement some custom SVG-based rendering for the checkboxes itself.

@j2L4e
Copy link
Author

j2L4e commented Dec 11, 2020

Something weird is going on anyway. When you edit and save - [ ] foo, the item is rendered as this

<li class="task-list-item">
  <span class="ui checkbox">
    <input type="checkbox" readonly="readonly">
    <label>
      <p>foo</p>
    </label>
  </span>
</li>

(which works as expected, label non-clickable but selectable)

After a page refresh it renders the clickable, non selectable version

<li class="task-list-item">
  <span class="ui checkbox">
    <input type="checkbox" readonly="readonly" tabindex="0" class="hidden">   
    <label>
      <p>foo</p>
    </label>
  </span>
</li>

@j2L4e
Copy link
Author

j2L4e commented Dec 11, 2020

Changing the selection state by clicking the box doesn't seem to be workng anyway at the moment (#7097), so this seems to be at least a temporary fix for the selection issue

@silverwind
Copy link
Member

silverwind commented Dec 11, 2020

I'll have a look later at removing the ui class. We don't really want Fomantic to interact with rendered markdown anyways.

@j2L4e
Copy link
Author

j2L4e commented Dec 11, 2020

Awesome, I'll close this one then, have a great day!

I think I'll be taking a shot at #7097 soon, mind if I ping you for that?

@j2L4e j2L4e closed this Dec 11, 2020
@silverwind
Copy link
Member

I guess I can assist there but you should wait on the fix for this one before starting there.

@j2L4e j2L4e deleted the patch-1 branch December 11, 2020 13:27
@go-gitea go-gitea locked and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to select and copy checklist items
3 participants