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

Handle non-flow content in paragraphs #46

Open
strogonoff opened this issue Feb 7, 2025 · 1 comment
Open

Handle non-flow content in paragraphs #46

strogonoff opened this issue Feb 7, 2025 · 1 comment
Assignees

Comments

@strogonoff
Copy link
Contributor

strogonoff commented Feb 7, 2025

HTML spec does not allow paragraphs to nest or have non-flow content.

MN XML allows paragraphs to nest. It allows paragraphs to have non-flow content, such as notes or footnotes or lists (which in turn can have more block content and paragraphs within).

Notably, and confusingly, both Metanorma and HTML preferred to call the paragraph <p>. Since Metanorma doesn’t call, say, notes <n>, I suppose either

  • Metanorma decided to mimic HTML tag naming, but made the behavior of the tag inconsistent with HTML (confusing), or
  • Metanorma decided to be randomly inconsistent in its element naming just for paragraphs, and accidentally collided with HTML naming (unlikely).

Not using paragraphs, but just divs, is not recommended for accessibility (and SEO, Web semantics, etc.) reasons. While there is now an ARIA role “paragraph” (which MDN does not recommend to use in favour of native tag), it is not quite clear how nested paragraph content is handled according to ARIA: most docs I could find simply describe this role as “a paragraph of text”; meanwhile, we know that screen readers etc. have special provisions for navigating between paragraphs, and it’s unclear whether nested non-flow content would interfere with such.

There are some options:

  • Use a custom tag (or a plain div) with role=paragraph.
    • This would require either YOLOing accessibility or testing paragraph handling with actual screen readers and other non-human HTML consumers.
  • Move non-flow content out of paragraphs. Paragraphs can be split at non-flow content.
    • This would break 1:1 mapping with Metanorma structure, which is not great but not a terribly big deal if we don’t need two-way transformation between Firelight resource structure and MN XML (which we don’t per one of my discussions with Ronald).
    • Split paragraphs would have adjusted IDs with sequential index appended.
    • There was a concern raised about indicating where the nested block belongs, but I believe it is a non-issue: MN XML is a order-important sequential document, and belonging of things together is based on order. (One litmus test to prove this is: if you try reordering items in a Metanorma XML representation of a standard, it will stop making sense.)

The current approach is the second one, and it works so far, but I am open to arguments.

@strogonoff strogonoff self-assigned this Feb 7, 2025
@strogonoff
Copy link
Contributor Author

@opoudjis has told me that lists in paragraphs is, in fact, a bug. I’ll file in in mn-samples-plateau

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

No branches or pull requests

1 participant