Skip to content

Conversation

@ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Oct 29, 2025

☑️ Resolves

🖼️ Screenshots

🏚️ Before 🏡 After
image image
image image

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@ShGKme ShGKme added this to the 9.2.0 milestone Oct 29, 2025
@ShGKme ShGKme self-assigned this Oct 29, 2025
@ShGKme ShGKme added bug Something isn't working 3. to review Waiting for reviews accessibility Making sure we design for the widest range of people possible, including those who have disabilities labels Oct 29, 2025
@ShGKme ShGKme force-pushed the fix/NcRichText--h4 branch from f49b29f to aaa836a Compare October 29, 2025 12:03
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.39%. Comparing base (551e4d7) to head (abdc336).
⚠️ Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
src/components/NcRichText/NcRichText.vue 66.66% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7748   +/-   ##
=======================================
  Coverage   43.38%   43.39%           
=======================================
  Files         277      277           
  Lines       17990    17996    +6     
  Branches     1009     1010    +1     
=======================================
+ Hits         7805     7809    +4     
- Misses      10134    10136    +2     
  Partials       51       51           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

Interesting approach – I guess it is indeed still semantic given as you say h1, h2 and h3 are used on the page. But not sure we could always guarantee no heading level is skipped?

@ShGKme
Copy link
Contributor Author

ShGKme commented Oct 29, 2025

/backport to stable8

Signed-off-by: Grigorii K. Shartsev <[email protected]>
@ShGKme ShGKme force-pushed the fix/NcRichText--h4 branch from aaa836a to abdc336 Compare October 29, 2025 13:36
@ShGKme
Copy link
Contributor Author

ShGKme commented Oct 29, 2025

Adjusted tests

@ShGKme
Copy link
Contributor Author

ShGKme commented Oct 29, 2025

But not sure we could always guarantee no heading level is skipped?

We cannot. But skipping isn't a problem if it doesn't break the structure. Users can also start with h6.

We can also use <section> element, but it doesn't seem to be well supported in the context of headings...

And the worst idea I have — actually query for the heading to start from the next level. But I'd avoid it.

// Using them for user content leads to accessibility issues
// Levelling down headings to start from <h4>
if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(String(type))) {
type = `h${Math.min(+String(type)[1] + 3, 6)}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this always valid? What if the component is used right under a h1?
Maybe we need some magic like $el.closest and then check whats the closest headline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if the component is used right under a h1?

Answered in the comment above

Copy link
Contributor

Choose a reason for hiding this comment

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

can we maybe apply some classes to visually differentiate #### heading from ###### heading?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, distinguish ##### from ###### must be already an edge case. It should mean that 4 heading levels were already used, and you still need 2 more levels. It's hard to imagine for me even in a dissertation, and this component is just for a comment/message.

And if users use h5-h6 without upper levels, then there is probably something wrong. For example, they may do it because h1-h3 are way too large. This is why I'm keeping them smaller here.

@kra-mo Maybe you have any opinion here? Should we have different styles for all h1..h6 and if we do, which style (keeping h1 small enough for a comment/message)?

Copy link
Member

Choose a reason for hiding this comment

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

@kra-mo Maybe you have any opinion here?

Personally, I don't see the need to differentiate visually. Some apps make headings even smaller than body text or use all-caps to indicate the levels, but I think both are suboptimal.

Copy link
Member

@kra-mo kra-mo left a comment

Choose a reason for hiding this comment

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

Nice, this will be a great improvement :)

Copy link
Contributor

@DorraJaouad DorraJaouad left a comment

Choose a reason for hiding this comment

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

Looks good

@ShGKme
Copy link
Contributor Author

ShGKme commented Nov 4, 2025

Merging with 2 designers approving the design with equal low-level heading styles.

@ShGKme ShGKme merged commit e8142b2 into main Nov 4, 2025
27 checks passed
@ShGKme ShGKme deleted the fix/NcRichText--h4 branch November 4, 2025 14:46
@backportbot
Copy link

backportbot bot commented Nov 4, 2025

The backport to stable8 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable8
git pull origin stable8

# Create the new backport branch
git checkout -b backport/7748/stable8

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick abdc336d

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/7748/stable8

Error: Failed to check for changes with origin/stable8: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews accessibility Making sure we design for the widest range of people possible, including those who have disabilities backport-request bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NcRichText] Level down headings in markdown

6 participants