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

[GHS/Style] List styles preserves itself and spreads to other list types and blocks. #14216

Closed
Tracked by #14274
Witoso opened this issue May 23, 2023 · 3 comments · Fixed by #14322
Closed
Tracked by #14274

[GHS/Style] List styles preserves itself and spreads to other list types and blocks. #14216

Witoso opened this issue May 23, 2023 · 3 comments · Fixed by #14322
Assignees
Labels
package:html-support package:style squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@Witoso
Copy link
Member

Witoso commented May 23, 2023

📝 Provide detailed reproduction steps (if any)

  1. Have a style defined for the ul
  2. Apply the style to the list.
  3. Two enters.
  4. Create an ol list.
  5. The class and style are there and it's not possible to disable it.
Screen.Recording.2023-05-23.at.14.03.29.mov

✔️ Expected result

ol doesn't have the style.

❌ Actual result

ol has the style.

❓ Possible solution

  1. Clear the htmlListAttributes on non-list blocks.
  2. Allow deleting the style even if it's on the wrong element! That would be at least some better UX for handling situations like this.

📃 Other details

Workarounds: delete the class via the Source mode or turn to a different list, disable the style turn back to the list type you wanted to have.


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@Witoso Witoso added type:bug This issue reports a buggy (incorrect) behavior. squad:core Issue to be handled by the Core team. package:html-support package:style labels May 23, 2023
@Witoso
Copy link
Member Author

Witoso commented May 24, 2023

  1. Research changing htmlAttributes to htmlXAttributes defined for each element (X). That would be a generic fix.
  2. On rename/change of the element remove the htmlXAttributes if they don't belong to the element.

@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label May 24, 2023
@filipsobol filipsobol self-assigned this May 24, 2023
@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels May 24, 2023
arkflpc added a commit that referenced this issue May 30, 2023
…s-to-htmlXAttributes

Other (html-support): Change `htmlAttributes` to `htmlXAttributes` where X represents the name of the view element. See #14216.

MINOR BREAKING CHANGE (html-support): The `htmlAttributes` model property has been replaced by `htmlXAttributes`, where "X" represents the name of the view element. Clients will need to modify their code accordingly by replacing all instances of `htmlAttributes` with `htmlXAttributes` for the respective view elements.
@filipsobol
Copy link
Member

filipsobol commented Jun 1, 2023

This task was split into 3 PRs:

niegowski added a commit that referenced this issue Jun 1, 2023
…es-from-unassociated-elements

Fix (html-support): Remove unrelated `html*Attributes` from elements. See #14216.
arkflpc added a commit that referenced this issue Jun 5, 2023
…butes

Feature (html-support): Changing list type removes styles from the old type. Closes #14216.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Jun 5, 2023
@filipsobol
Copy link
Member

filipsobol commented Jun 5, 2023

Since styles leaking to other elements is a recurring problem, we decided to look at it more broadly and fix it so that it doesn't happen in any case, not just the one described in this ticket.

We decided to rename the attribute created by GHS (General HTML Support) that the style plugin depends on from a generic htmlAttributes used by all elements to a unique name html*Attributes for each element type, where * is the name of that element, e.g: htmlDivAttributes or htmlH1Attributes. This allows us to filter out unwanted attributes from the elements.

This way, when we:

  • insert an H1 element and press Enter at the end, the newly created paragraph will not inherit H1's HTML attributes (previously, this case required a special handler),
  • change the list type from ordered to unordered or vice versa, the old style will be removed,
  • Follow the steps described in this ticket, paragraph and subsequent lists will not inherit styles from the first list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:html-support package:style squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
3 participants