fix(TaskItem): use div instead of label element as task item wrapper#8568
Open
mejo- wants to merge 2 commits into
Open
fix(TaskItem): use div instead of label element as task item wrapper#8568mejo- wants to merge 2 commits into
mejo- wants to merge 2 commits into
Conversation
Member
Author
|
/backport to stable33 |
Signed-off-by: Jonas <jonas@freesources.org>
Fixes problems with more than one block node in task items. `label` elements have special click behaviour: clicking on them fires a second click on the their first "labelable" descendant. This resulted in weird bugs when having e.g. a code block or image as second block node in a task item. Fixes: #5225 Signed-off-by: Jonas <jonas@freesources.org>
6a91b76 to
666b36d
Compare
Comment on lines
+52
to
63
| const checkboxAttributes: { | ||
| type: string | ||
| class: string | ||
| contenteditable: boolean | ||
| checked?: true | ||
| } = { | ||
| type: 'checkbox', | ||
| class: '', | ||
| contenteditable: false, | ||
| } | ||
| if (node.attrs.checked) { | ||
| checkboxAttributes.checked = true |
Collaborator
There was a problem hiding this comment.
I think if you have an object that never changes you can get a very precise type annotation with Object.freeze for free:
Suggested change
| const checkboxAttributes: Object.freeze({ | |
| type: 'checkbox', | |
| class: '', | |
| contenteditable: false, | |
| ...( node.attrs.checked ? { checked: true } : {} ), | |
| }) |
In this case checkboxAttributes.type will not just be a string but the string checkbox and it will be readonly.
Collaborator
|
I'm wondering if this has downsides in terms of accessibility. I checked but right now that extra click is not used, right? At least clicking the text of a task item does not (un-)check it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Fixes problems with more than one block node in task items.
labelelements have special click behaviour: clicking on them fires a second click on the their first "labelable" descendant.This resulted in weird bugs when having e.g. a code block or image as second block node in a task item.
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)