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(core): correctly reset PTE list counts #7286

Merged
merged 1 commit into from
Aug 2, 2024
Merged

fix(core): correctly reset PTE list counts #7286

merged 1 commit into from
Aug 2, 2024

Conversation

christianhg
Copy link
Member

Description

I was reading the docs on counter-reset when this paragraph suddenly stood out:

After creating a counter using counter-reset, you can adjust its value by
using the counter-set property. This is counterintuitive because, despite
its name, the counter-reset property is used for creating and initializing
counters, while the counter-set property is used for resetting the value
of an existing counter.

This made me realise that we probably used content-reset somewhere, incorrectly, where we actually meant to use counter-set.

Before this change, counters on each list level would not reset at all across a PTE document. Now, the counters reset properly.

Before:

1. This
  a. is
    i. nested
      1. list
This is a paragraph
      2. This
    ii. is
  b. another nested
2. list

After:

1. This
  a. is
    i. nested
      1. list
This is a paragraph
      1. This
    i. is
  a. another nested
1. list

Studio screenshots:

Before:

Screenshot 2024-07-31 at 10 41 04

After:

Screenshot 2024-07-31 at 10 40 37

What to review

If you know of some large documents with lots of content and lists at different levels, then that might be helpful when reviewing if this change has any adverse effects.

Testing

I created various lists in a document broken up by various other elements and visually verified the list counts. Manual testing it the most practical method here.

Notes for release

I was reading the docs on [`counter-reset`](https://developer.mozilla.org/en-US/docs/Web/CSS/counter-reset#description) when this paragraph suddenly stood out:

> After creating a counter using `counter-reset`, you can adjust its value by
> using the `counter-set` property. This is counterintuitive because, despite
> its name, the `counter-reset` property is used for creating and initializing
> counters, while the `counter-set` property is used for resetting the value
> of an existing counter.

This made me realise that we probably used `content-reset` somewhere,
incorrectly, where we actually meant to use `counter-set`.

Before this change, counters on each list level would not reset at all across a
PTE document. Now, the counters reset properly.

Before:

```
1. This
  a. is
    i. nested
      1. list
This is a paragraph
      2. This
    ii. is
  b. another nested
2. list
```

After:

```
1. This
  a. is
    i. nested
      1. list
This is a paragraph
      1. This
    i. is
  a. another nested
1. list
```
@christianhg christianhg requested review from a team and jordanl17 and removed request for a team July 31, 2024 08:47
Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:53am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:53am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:53am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:53am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:53am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jul 31, 2024 8:53am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Jul 31, 2024 9:03 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 43s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 37s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 44s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 43s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 14s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 8s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 25s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ❌ Failed (Inspect) 1m 34s 19 0 2
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 48s 30 0 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 19s 3 0 0

Copy link
Member

@stipsan stipsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@stipsan stipsan added this pull request to the merge queue Aug 2, 2024
Merged via the queue into next with commit acbc351 Aug 2, 2024
42 checks passed
@stipsan stipsan deleted the fix-list-counts branch August 2, 2024 11:15
cngonzalez pushed a commit that referenced this pull request Aug 20, 2024
I was reading the docs on [`counter-reset`](https://developer.mozilla.org/en-US/docs/Web/CSS/counter-reset#description) when this paragraph suddenly stood out:

> After creating a counter using `counter-reset`, you can adjust its value by
> using the `counter-set` property. This is counterintuitive because, despite
> its name, the `counter-reset` property is used for creating and initializing
> counters, while the `counter-set` property is used for resetting the value
> of an existing counter.

This made me realise that we probably used `content-reset` somewhere,
incorrectly, where we actually meant to use `counter-set`.

Before this change, counters on each list level would not reset at all across a
PTE document. Now, the counters reset properly.

Before:

```
1. This
  a. is
    i. nested
      1. list
This is a paragraph
      2. This
    ii. is
  b. another nested
2. list
```

After:

```
1. This
  a. is
    i. nested
      1. list
This is a paragraph
      1. This
    i. is
  a. another nested
1. list
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants