tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH 0/3] Add HTML landmarks
@ 2022-06-28 18:18 Anna Vyalkova
  2022-06-28 18:18 ` [PATCH 1/3] Wrap manual header in the "<header>" tag Anna Vyalkova
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-06-28 18:18 UTC (permalink / raw)
  To: tech

So I did some tests and "aria-hidden" is not needed with landmarks as
there are navigation commands to skip to the next landmark.


--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-06-28 18:18 [PATCH 0/3] Add HTML landmarks Anna Vyalkova
@ 2022-06-28 18:18 ` Anna Vyalkova
  2022-07-03 17:24   ` Ingo Schwarze
  2022-06-28 18:18 ` [PATCH 2/3] Wrap manual text in the "<main>" tag Anna Vyalkova
  2022-06-28 18:18 ` [PATCH 3/3] Wrap manual footer in the "<footer>" tag Anna Vyalkova
  2 siblings, 1 reply; 14+ messages in thread
From: Anna Vyalkova @ 2022-06-28 18:18 UTC (permalink / raw)
  To: tech

---
 html.c      | 1 +
 html.h      | 1 +
 man_html.c  | 4 +++-
 mandoc.css  | 3 ++-
 mdoc_html.c | 4 +++-
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/html.c b/html.c
index 0199edb0..f97c9eee 100644
--- a/html.c
+++ b/html.c
@@ -70,6 +70,7 @@ static	const struct htmldata htmltags[TAG_MAX] = {
 	{"div",		HTML_NLAROUND},
 	{"section",	HTML_NLALL},
 	{"nav",		HTML_NLALL},
+	{"header",	HTML_NLALL},
 	{"table",	HTML_NLALL | HTML_INDENT},
 	{"tr",		HTML_NLALL | HTML_INDENT},
 	{"td",		HTML_NLAROUND},
diff --git a/html.h b/html.h
index 32742461..87dd057c 100644
--- a/html.h
+++ b/html.h
@@ -30,6 +30,7 @@ enum	htmltag {
 	TAG_DIV,
 	TAG_SECTION,
 	TAG_NAV,
+	TAG_HEADER,
 	TAG_TABLE,
 	TAG_TR,
 	TAG_TD,
diff --git a/man_html.c b/man_html.c
index 5f715cf0..062ce899 100644
--- a/man_html.c
+++ b/man_html.c
@@ -263,13 +263,14 @@ print_man_node(MAN_ARGS)
 static void
 man_root_pre(const struct roff_meta *man, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*th, *t, *tt;
 	char		*title;
 
 	assert(man->title);
 	assert(man->msec);
 	mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
 
+	th = print_otag(h, TAG_HEADER, "");
 	t = print_otag(h, TAG_TABLE, "c", "head");
 	tt = print_otag(h, TAG_TR, "");
 
@@ -285,6 +286,7 @@ man_root_pre(const struct roff_meta *man, struct html *h)
 	print_otag(h, TAG_TD, "c", "head-rtitle");
 	print_text(h, title);
 	print_tagq(h, t);
+	print_tagq(h, th);
 	free(title);
 }
 
diff --git a/mandoc.css b/mandoc.css
index 73f5c668..4cfb51e8 100644
--- a/mandoc.css
+++ b/mandoc.css
@@ -53,7 +53,8 @@ table.results {	margin-top: 1em;
 
 /* Header and footer lines. */
 
-table.head {	width: 100%;
+header > table {
+		width: 100%;
 		border-bottom: 1px dotted #808080;
 		margin-bottom: 1em;
 		font-size: smaller; }
diff --git a/mdoc_html.c b/mdoc_html.c
index a0e29c72..cf771b75 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -470,7 +470,7 @@ mdoc_root_post(const struct roff_meta *meta, struct html *h)
 static int
 mdoc_root_pre(const struct roff_meta *meta, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*th, *t, *tt;
 	char		*volume, *title;
 
 	if (NULL == meta->arch)
@@ -485,6 +485,7 @@ mdoc_root_pre(const struct roff_meta *meta, struct html *h)
 		mandoc_asprintf(&title, "%s(%s)",
 		    meta->title, meta->msec);
 
+	th = print_otag(h, TAG_HEADER, "");
 	t = print_otag(h, TAG_TABLE, "c", "head");
 	tt = print_otag(h, TAG_TR, "");
 
@@ -499,6 +500,7 @@ mdoc_root_pre(const struct roff_meta *meta, struct html *h)
 	print_otag(h, TAG_TD, "c", "head-rtitle");
 	print_text(h, title);
 	print_tagq(h, t);
+	print_tagq(h, th);
 
 	free(title);
 	free(volume);
-- 
2.35.1

--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/3] Wrap manual text in the "<main>" tag
  2022-06-28 18:18 [PATCH 0/3] Add HTML landmarks Anna Vyalkova
  2022-06-28 18:18 ` [PATCH 1/3] Wrap manual header in the "<header>" tag Anna Vyalkova
@ 2022-06-28 18:18 ` Anna Vyalkova
  2022-07-03 14:41   ` Ingo Schwarze
  2022-06-28 18:18 ` [PATCH 3/3] Wrap manual footer in the "<footer>" tag Anna Vyalkova
  2 siblings, 1 reply; 14+ messages in thread
From: Anna Vyalkova @ 2022-06-28 18:18 UTC (permalink / raw)
  To: tech

---
 html.c      | 1 +
 html.h      | 1 +
 man_html.c  | 2 +-
 mandoc.css  | 3 +--
 mdoc_html.c | 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/html.c b/html.c
index f97c9eee..62479543 100644
--- a/html.c
+++ b/html.c
@@ -71,6 +71,7 @@ static	const struct htmldata htmltags[TAG_MAX] = {
 	{"section",	HTML_NLALL},
 	{"nav",		HTML_NLALL},
 	{"header",	HTML_NLALL},
+	{"main",	HTML_NLALL},
 	{"table",	HTML_NLALL | HTML_INDENT},
 	{"tr",		HTML_NLALL | HTML_INDENT},
 	{"td",		HTML_NLAROUND},
diff --git a/html.h b/html.h
index 87dd057c..53a865f6 100644
--- a/html.h
+++ b/html.h
@@ -31,6 +31,7 @@ enum	htmltag {
 	TAG_SECTION,
 	TAG_NAV,
 	TAG_HEADER,
+	TAG_MAIN,
 	TAG_TABLE,
 	TAG_TR,
 	TAG_TD,
diff --git a/man_html.c b/man_html.c
index 062ce899..817f4898 100644
--- a/man_html.c
+++ b/man_html.c
@@ -132,7 +132,7 @@ html_man(void *arg, const struct roff_meta *man)
 	}
 
 	man_root_pre(man, h);
-	t = print_otag(h, TAG_DIV, "c", "manual-text");
+	t = print_otag(h, TAG_MAIN, "c", "manual-text");
 	print_man_nodelist(man, n, h);
 	print_tagq(h, t);
 	man_root_post(man, h);
diff --git a/mandoc.css b/mandoc.css
index 4cfb51e8..4e0afd7c 100644
--- a/mandoc.css
+++ b/mandoc.css
@@ -70,8 +70,7 @@ td.foot-os {	text-align: right; }
 
 /* Sections and paragraphs. */
 
-.manual-text {
-		margin-left: 3.8em; }
+main {		margin-left: 3.8em; }
 .Nd { }
 section.Sh { }
 h1.Sh {		margin-top: 1.2em;
diff --git a/mdoc_html.c b/mdoc_html.c
index cf771b75..1fe3a7ed 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -302,7 +302,7 @@ html_mdoc(void *arg, const struct roff_meta *mdoc)
 	}
 
 	mdoc_root_pre(mdoc, h);
-	t = print_otag(h, TAG_DIV, "c", "manual-text");
+	t = print_otag(h, TAG_MAIN, "c", "manual-text");
 	print_mdoc_nodelist(mdoc, n, h);
 	print_tagq(h, t);
 	mdoc_root_post(mdoc, h);
-- 
2.35.1

--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/3] Wrap manual footer in the "<footer>" tag
  2022-06-28 18:18 [PATCH 0/3] Add HTML landmarks Anna Vyalkova
  2022-06-28 18:18 ` [PATCH 1/3] Wrap manual header in the "<header>" tag Anna Vyalkova
  2022-06-28 18:18 ` [PATCH 2/3] Wrap manual text in the "<main>" tag Anna Vyalkova
@ 2022-06-28 18:18 ` Anna Vyalkova
  2 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-06-28 18:18 UTC (permalink / raw)
  To: tech

---
 html.c      | 1 +
 html.h      | 1 +
 man_html.c  | 4 +++-
 mandoc.css  | 3 ++-
 mdoc_html.c | 4 +++-
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/html.c b/html.c
index 62479543..246d771e 100644
--- a/html.c
+++ b/html.c
@@ -72,6 +72,7 @@ static	const struct htmldata htmltags[TAG_MAX] = {
 	{"nav",		HTML_NLALL},
 	{"header",	HTML_NLALL},
 	{"main",	HTML_NLALL},
+	{"footer",	HTML_NLALL},
 	{"table",	HTML_NLALL | HTML_INDENT},
 	{"tr",		HTML_NLALL | HTML_INDENT},
 	{"td",		HTML_NLAROUND},
diff --git a/html.h b/html.h
index 53a865f6..085c11c9 100644
--- a/html.h
+++ b/html.h
@@ -32,6 +32,7 @@ enum	htmltag {
 	TAG_NAV,
 	TAG_HEADER,
 	TAG_MAIN,
+	TAG_FOOTER,
 	TAG_TABLE,
 	TAG_TR,
 	TAG_TD,
diff --git a/man_html.c b/man_html.c
index 817f4898..743f5236 100644
--- a/man_html.c
+++ b/man_html.c
@@ -293,8 +293,9 @@ man_root_pre(const struct roff_meta *man, struct html *h)
 static void
 man_root_post(const struct roff_meta *man, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*tf, *t, *tt;
 
+	tf = print_otag(h, TAG_FOOTER, "");
 	t = print_otag(h, TAG_TABLE, "c", "foot");
 	tt = print_otag(h, TAG_TR, "");
 
@@ -306,6 +307,7 @@ man_root_post(const struct roff_meta *man, struct html *h)
 	if (man->os != NULL)
 		print_text(h, man->os);
 	print_tagq(h, t);
+	print_tagq(h, tf);
 }
 
 static int
diff --git a/mandoc.css b/mandoc.css
index 4e0afd7c..40cacbc3 100644
--- a/mandoc.css
+++ b/mandoc.css
@@ -62,7 +62,8 @@ td.head-vol {	text-align: center; }
 td.head-rtitle {
 		text-align: right; }
 
-table.foot {	width: 100%;
+footer > table {
+		width: 100%;
 		border-top: 1px dotted #808080;
 		margin-top: 1em;
 		font-size: smaller; }
diff --git a/mdoc_html.c b/mdoc_html.c
index 1fe3a7ed..8b44d188 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -453,8 +453,9 @@ print_mdoc_node(MDOC_ARGS)
 static void
 mdoc_root_post(const struct roff_meta *meta, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*tf, *t, *tt;
 
+	tf = print_otag(h, TAG_FOOTER, "");
 	t = print_otag(h, TAG_TABLE, "c", "foot");
 	tt = print_otag(h, TAG_TR, "");
 
@@ -465,6 +466,7 @@ mdoc_root_post(const struct roff_meta *meta, struct html *h)
 	print_otag(h, TAG_TD, "c", "foot-os");
 	print_text(h, meta->os);
 	print_tagq(h, t);
+	print_tagq(h, tf);
 }
 
 static int
-- 
2.35.1

--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] Wrap manual text in the "<main>" tag
  2022-06-28 18:18 ` [PATCH 2/3] Wrap manual text in the "<main>" tag Anna Vyalkova
@ 2022-07-03 14:41   ` Ingo Schwarze
  0 siblings, 0 replies; 14+ messages in thread
From: Ingo Schwarze @ 2022-07-03 14:41 UTC (permalink / raw)
  To: Anna Vyalkova; +Cc: tech

Hello Anna,

Anna Vyalkova wrote on Tue, Jun 28, 2022 at 11:18:43PM +0500:

>  html.c      | 1 +
>  html.h      | 1 +
>  man_html.c  | 2 +-
>  mandoc.css  | 3 +--
>  mdoc_html.c | 2 +-
>  5 files changed, 5 insertions(+), 4 deletions(-)
[...]
> -	t = print_otag(h, TAG_DIV, "c", "manual-text");
> +	t = print_otag(h, TAG_MAIN, "c", "manual-text");
[...]

Thank you!

I committed your patch in the form appended below.
In particular, there was a second instance of ".manual-text"
for the benefit of mobile devices.

Yours,
  Ingo


Log Message:
-----------
Instead of the custom <div class="manual-text">, use the standard 
HTML <main> element.  The benefit is that it has the ARIA landmark 
role "main" by default.  To ease the transition for people using 
their own CSS file instead of mandoc.css, retain the custom class
for now.

I had this idea in a discussion with Anna Vyalkova <cyber at sysrq dot in>.
Patch from Anna, slightly tweaked by me.

Modified Files:
--------------
    mandoc:
        html.c
        html.h
        man_html.c
        mandoc.css
        mdoc_html.c

Revision Data
-------------
Index: mandoc.css
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v
retrieving revision 1.49
retrieving revision 1.50
diff -Lmandoc.css -Lmandoc.css -u -p -r1.49 -r1.50
--- mandoc.css
+++ mandoc.css
@@ -69,8 +69,7 @@ td.foot-os {	text-align: right; }
 
 /* Sections and paragraphs. */
 
-.manual-text {
-		margin-left: 3.8em; }
+main {		margin-left: 3.8em; }
 .Nd { }
 section.Sh { }
 h1.Sh {		margin-top: 1.2em;
@@ -338,8 +337,7 @@ h1.Sh::before, h2.Ss::before, .St::befor
 /* Overrides to avoid excessive margins on small devices. */
 
 @media (max-width: 37.5em) {
-.manual-text {
-		margin-left: 0.5em; }
+main {		margin-left: 0.5em; }
 h1.Sh, h2.Ss {	margin-left: 0em; }
 .Bd-indent {	margin-left: 2em; }
 .Bl-hang > dd {
Index: html.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -Lhtml.h -Lhtml.h -u -p -r1.110 -r1.111
--- html.h
+++ html.h
@@ -27,6 +27,7 @@ enum	htmltag {
 	TAG_STYLE,
 	TAG_TITLE,
 	TAG_BODY,
+	TAG_MAIN,
 	TAG_DIV,
 	TAG_SECTION,
 	TAG_NAV,
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v
retrieving revision 1.344
retrieving revision 1.345
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.344 -r1.345
--- mdoc_html.c
+++ mdoc_html.c
@@ -302,7 +302,7 @@ html_mdoc(void *arg, const struct roff_m
 	}
 
 	mdoc_root_pre(mdoc, h);
-	t = print_otag(h, TAG_DIV, "c", "manual-text");
+	t = print_otag(h, TAG_MAIN, "c", "manual-text");
 	print_mdoc_nodelist(mdoc, n, h);
 	print_tagq(h, t);
 	mdoc_root_post(mdoc, h);
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -Lman_html.c -Lman_html.c -u -p -r1.179 -r1.180
--- man_html.c
+++ man_html.c
@@ -132,7 +132,7 @@ html_man(void *arg, const struct roff_me
 	}
 
 	man_root_pre(man, h);
-	t = print_otag(h, TAG_DIV, "c", "manual-text");
+	t = print_otag(h, TAG_MAIN, "c", "manual-text");
 	print_man_nodelist(man, n, h);
 	print_tagq(h, t);
 	man_root_post(man, h);
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.276
retrieving revision 1.277
diff -Lhtml.c -Lhtml.c -u -p -r1.276 -r1.277
--- html.c
+++ html.c
@@ -2,6 +2,7 @@
 /*
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -67,6 +68,7 @@ static	const struct htmldata htmltags[TA
 	{"style",	HTML_NLALL | HTML_INDENT},
 	{"title",	HTML_NLAROUND},
 	{"body",	HTML_NLALL},
+	{"main",	HTML_NLALL},
 	{"div",		HTML_NLAROUND},
 	{"section",	HTML_NLALL},
 	{"nav",		HTML_NLALL},
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-06-28 18:18 ` [PATCH 1/3] Wrap manual header in the "<header>" tag Anna Vyalkova
@ 2022-07-03 17:24   ` Ingo Schwarze
  2022-07-03 18:49     ` Anna Vyalkova
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Schwarze @ 2022-07-03 17:24 UTC (permalink / raw)
  To: Anna; +Cc: tech

Hello Anna,

Anna Vyalkova wrote on Tue, Jun 28, 2022 at 11:18:42PM +0500:

[...]
> diff --git a/mandoc.css b/mandoc.css
> index 73f5c668..4cfb51e8 100644
> --- a/mandoc.css
> +++ b/mandoc.css
> @@ -53,7 +53,8 @@ table.results {	margin-top: 1em;
>  
>  /* Header and footer lines. */
>  
> -table.head {	width: 100%;
> +header > table {
> +		width: 100%;
>  		border-bottom: 1px dotted #808080;
>  		margin-bottom: 1em;
>  		font-size: smaller; }
> diff --git a/mdoc_html.c b/mdoc_html.c
> index a0e29c72..cf771b75 100644
> --- a/mdoc_html.c
> +++ b/mdoc_html.c
> @@ -470,7 +470,7 @@ mdoc_root_post(const struct roff_meta *meta, struct html *h)
>  static int
>  mdoc_root_pre(const struct roff_meta *meta, struct html *h)
>  {
> -	struct tag	*t, *tt;
> +	struct tag	*th, *t, *tt;
>  	char		*volume, *title;
>  
>  	if (NULL == meta->arch)
> @@ -485,6 +485,7 @@ mdoc_root_pre(const struct roff_meta *meta, struct html *h)
>  		mandoc_asprintf(&title, "%s(%s)",
>  		    meta->title, meta->msec);
>  
> +	th = print_otag(h, TAG_HEADER, "");
>  	t = print_otag(h, TAG_TABLE, "c", "head");
>  	tt = print_otag(h, TAG_TR, "");
>  
> @@ -499,6 +500,7 @@ mdoc_root_pre(const struct roff_meta *meta, struct html *h)
>  	print_otag(h, TAG_TD, "c", "head-rtitle");
>  	print_text(h, title);
>  	print_tagq(h, t);
> +	print_tagq(h, th);
>  
>  	free(title);
>  	free(volume);

I fully agree that the current <table class="head"> is insufficient
because it has no ARIA effect.

I also agree that using <header> is not wrong because the HTML
standard defines it very vaguely:

  https://html.spec.whatwg.org/multipage/sections.html#the-header-element

  The header element represents a group of introductory
  or navigational aids.

However, according to the HTML-ARIA standard, the default role of <header>
is "banner" if it is a child of <body>, and "banner" is the wrong role
because WAI-ARIA defines it as follows:

  https://www.w3.org/TR/wai-aria-1.1/#banner

  A region that contains mostly site-oriented content, rather than
  page-specific content.

  Site-oriented content typically includes things such as the logo or
  identity of the site sponsor, and a site-specific search tool. A
  banner usually appears at the top of the page and typically spans
  the full width.

The table in question is clearly page-specific and definitely
not the same for all documents on the site.  I really think we
should better use the role "doc-pageheader" here and not "banner".

We might of course consider using <header role="doc-pageheader">,
but that would seem unfortunate to me because in the case of man.cgi(8)
output, we really need the "banner" role (ideally getting it as the default
from a header element) for the site name (e.g. "OpenBSD manual page server")
and the search form ("Manual Page Search Parameters").  Using <header>
for *that* would perfectly fit the definition of the "banner" role
cited above.

As far as i can see, the HTML standard does not prohibit having two
<header> elements in a row, for example like this:

  <body>
    <header>
      <h1><a href="https://www.openbsd.org/">OpenBSD</a>
          manual page server</h1>
      <form action="/" method="get" autocomplete="off" autocapitalize="none">
      ...
      </form>
    </header>
    <hr>
    <header role="doc-pageheader">
      <table class="head">
        <tr>
          <td class="head-ltitle">PF.CONF(5)</td>
          <td class="head-vol">File Formats Manual</td>
          <td class="head-rtitle">PF.CONF(5)</td>
        </tr>
      </table>
    </header>
    <main>

But that would seem ugly to me.  Or do you think having two consecutive
<header> elements here would be fine?

https://stackoverflow.com/questions/21655804/html5-multiple-footers-headers-in-a-section (which is of course not authoritative) says

  There is no prohibition against having e.g. two header elements
  (at the same level of nesting) in an article element. They would
  then both contain “introductory content” for it. It is however
  difficult to imagine situations where this would make sense, since
  header elements normally precede other content, and the header
  would thus be adjacent and could be combined into one.

Here, they could not easily be combined into one because the search
form is written by cgi.c whereas the <table class="head"> is written
by html.c.  That's not just an implementation detail because both
headers serve a significantly different purpose: the first one
presents site-oriented content, the second one is specific to the
manual page being shown.

Do you think having two consecutive headers right below <body> would
be good here, or what should we do instead?

If so, should we maybe explicitly set <header role="banner"> on the
first header even though that is redundant, to make it more apparent
why we have two headers?

For the footer, using <footer role="doc-pagefooter"> poses fewer
problems because we only need one single footer.  But i'd like to
solve the trickier case of the headers first before deciding how to
mark up the footer.

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-03 17:24   ` Ingo Schwarze
@ 2022-07-03 18:49     ` Anna Vyalkova
  2022-07-03 20:12       ` Ingo Schwarze
  0 siblings, 1 reply; 14+ messages in thread
From: Anna Vyalkova @ 2022-07-03 18:49 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

On 2022-07-03 19:24, Ingo Schwarze wrote:
> Hello Anna,
> 
> Anna Vyalkova wrote on Tue, Jun 28, 2022 at 11:18:42PM +0500:
> 
> [...]
> > diff --git a/mandoc.css b/mandoc.css
> > index 73f5c668..4cfb51e8 100644
> > --- a/mandoc.css
> > +++ b/mandoc.css
> > @@ -53,7 +53,8 @@ table.results {	margin-top: 1em;
> >  
> >  /* Header and footer lines. */
> >  
> > -table.head {	width: 100%;
> > +header > table {
> > +		width: 100%;
> >  		border-bottom: 1px dotted #808080;
> >  		margin-bottom: 1em;
> >  		font-size: smaller; }
> > diff --git a/mdoc_html.c b/mdoc_html.c
> > index a0e29c72..cf771b75 100644
> > --- a/mdoc_html.c
> > +++ b/mdoc_html.c
> > @@ -470,7 +470,7 @@ mdoc_root_post(const struct roff_meta *meta, struct html *h)
> >  static int
> >  mdoc_root_pre(const struct roff_meta *meta, struct html *h)
> >  {
> > -	struct tag	*t, *tt;
> > +	struct tag	*th, *t, *tt;
> >  	char		*volume, *title;
> >  
> >  	if (NULL == meta->arch)
> > @@ -485,6 +485,7 @@ mdoc_root_pre(const struct roff_meta *meta, struct html *h)
> >  		mandoc_asprintf(&title, "%s(%s)",
> >  		    meta->title, meta->msec);
> >  
> > +	th = print_otag(h, TAG_HEADER, "");
> >  	t = print_otag(h, TAG_TABLE, "c", "head");
> >  	tt = print_otag(h, TAG_TR, "");
> >  
> > @@ -499,6 +500,7 @@ mdoc_root_pre(const struct roff_meta *meta, struct html *h)
> >  	print_otag(h, TAG_TD, "c", "head-rtitle");
> >  	print_text(h, title);
> >  	print_tagq(h, t);
> > +	print_tagq(h, th);
> >  
> >  	free(title);
> >  	free(volume);
> 
> I fully agree that the current <table class="head"> is insufficient
> because it has no ARIA effect.
> 
> I also agree that using <header> is not wrong because the HTML
> standard defines it very vaguely:
> 
>   https://html.spec.whatwg.org/multipage/sections.html#the-header-element
> 
>   The header element represents a group of introductory
>   or navigational aids.
> 
> However, according to the HTML-ARIA standard, the default role of <header>
> is "banner" if it is a child of <body>, and "banner" is the wrong role
> because WAI-ARIA defines it as follows:
> 
>   https://www.w3.org/TR/wai-aria-1.1/#banner
> 
>   A region that contains mostly site-oriented content, rather than
>   page-specific content.
> 
>   Site-oriented content typically includes things such as the logo or
>   identity of the site sponsor, and a site-specific search tool. A
>   banner usually appears at the top of the page and typically spans
>   the full width.
> 
> The table in question is clearly page-specific and definitely
> not the same for all documents on the site.  I really think we
> should better use the role "doc-pageheader" here and not "banner".

Yes, this is according to the standards (and to common sense, since
these sections are not worth assigning landmark roles). However only a
few screen readers support "doc-pageheader" and "doc-pagefooter" roles,
so an 'aria-label' tag may be needed in addition to avoid confusion:

  <header role="doc-pageheader" aria-label="Manual header line">

> We might of course consider using <header role="doc-pageheader">,
> but that would seem unfortunate to me because in the case of man.cgi(8)
> output, we really need the "banner" role (ideally getting it as the default
> from a header element) for the site name (e.g. "OpenBSD manual page server")
> and the search form ("Manual Page Search Parameters").  Using <header>
> for *that* would perfectly fit the definition of the "banner" role
> cited above.
> 
> As far as i can see, the HTML standard does not prohibit having two
> <header> elements in a row, for example like this:
> 
>   <body>
>     <header>
>       <h1><a href="https://www.openbsd.org/">OpenBSD</a>
>           manual page server</h1>

If it's only one H1, assigning it a banner role makes little sense as
it's already reflected in the document hierarchy.

>       <form action="/" method="get" autocomplete="off" autocapitalize="none">
>       ...
>       </form>

The search form needs to be top-level with role="search" to be
considered as a landmark:

  <body>
    <!-- custom site header -->
    <form action="/" method="get" autocomplete="off" autocapitalize="none" role="search">
    ...
    </form>

>     </header>
>     <hr>
>     <header role="doc-pageheader">
>       <table class="head">
>         <tr>
>           <td class="head-ltitle">PF.CONF(5)</td>
>           <td class="head-vol">File Formats Manual</td>
>           <td class="head-rtitle">PF.CONF(5)</td>
>         </tr>
>       </table>
>     </header>
>     <main>
> 
> But that would seem ugly to me.  Or do you think having two consecutive
> <header> elements here would be fine?

I think it's fine

1) in semantic sense (they are still headers and footers, just
   page-specific ones)
2) so we can write "header > table" in CSS
 
> https://stackoverflow.com/questions/21655804/html5-multiple-footers-headers-in-a-section (which is of course not authoritative) says
> 
>   There is no prohibition against having e.g. two header elements
>   (at the same level of nesting) in an article element. They would
>   then both contain “introductory content” for it. It is however
>   difficult to imagine situations where this would make sense, since
>   header elements normally precede other content, and the header
>   would thus be adjacent and could be combined into one.
>
> Here, they could not easily be combined into one because the search
> form is written by cgi.c whereas the <table class="head"> is written
> by html.c.  That's not just an implementation detail because both
> headers serve a significantly different purpose: the first one
> presents site-oriented content, the second one is specific to the
> manual page being shown.
> 
> Do you think having two consecutive headers right below <body> would
> be good here, or what should we do instead?

This won't happen with my proposal. Either this:

<form>
<header>

or this:

<form>
<nav> (with <table class="results">)
<header>

> If so, should we maybe explicitly set <header role="banner"> on the
> first header even though that is redundant, to make it more apparent
> why we have two headers?
> 
> For the footer, using <footer role="doc-pagefooter"> poses fewer
> problems because we only need one single footer.  But i'd like to
> solve the trickier case of the headers first before deciding how to
> mark up the footer.
> 
> Yours,
>   Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-03 18:49     ` Anna Vyalkova
@ 2022-07-03 20:12       ` Ingo Schwarze
  2022-07-03 20:51         ` Anna “CyberTailor”
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Schwarze @ 2022-07-03 20:12 UTC (permalink / raw)
  To: Anna Vyalkova; +Cc: tech

Hello Anna,

thank your for your explanations, i think i'm getting closer to
understanding these things.  However, a few details still confuse me:

Anna Vyalkova wrote on Sun, Jul 03, 2022 at 11:49:47PM +0500:
> On 2022-07-03 19:24, Ingo Schwarze wrote:

>> The table in question is clearly page-specific and definitely
>> not the same for all documents on the site.  I really think we
>> should better use the role "doc-pageheader" here and not "banner".

> Yes, this is according to the standards (and to common sense, since
> these sections are not worth assigning landmark roles). However only a
> few screen readers support "doc-pageheader" and "doc-pagefooter" roles,

Ouch.  Is there some way to find out (for a person like me who
lacks experience with assistive technology) which ARIA features are
well-supported across a wide range of assistive technology software
and which tend to be poorly supported or unsupported by some software?

> so an 'aria-label' tag may be needed in addition to avoid confusion:
> 
>   <header role="doc-pageheader" aria-label="Manual header line">

Sure, we can do that.  Still, i am curious how exactly the aria-label
attribute helps in this context.  As far as i understand, the
aria-label is just a name (invisible to the eye) for an HTML element
and doesn't imply anything about document structure.  What difference
does it make for a screen reader whether the aria-label is present or
absent?  Why would a user ever want the words "Manual header line"
read out at them?

>> We might of course consider using <header role="doc-pageheader">,
>> but that would seem unfortunate to me because in the case of man.cgi(8)
>> output, we really need the "banner" role (ideally getting it as the default
>> from a header element) for the site name (e.g. "OpenBSD manual page server")
>> and the search form ("Manual Page Search Parameters").  Using <header>
>> for *that* would perfectly fit the definition of the "banner" role
>> cited above.
>> 
>> As far as i can see, the HTML standard does not prohibit having two
>> <header> elements in a row, for example like this:
>> 
>>   <body>
>>     <header>
>>       <h1><a href="https://www.openbsd.org/">OpenBSD</a>
>>           manual page server</h1>

> If it's only one H1, assigning it a banner role makes little sense as
> it's already reflected in the document hierarchy.

>>       <form action="/" method="get" autocomplete="off" autocapitalize="none">
>>       ...
>>       </form>

> The search form needs to be top-level with role="search" to be
> considered as a landmark:

Yes, the form needs role="search", no doubt about that.

But why does the form need to be top-level in order to be assigned a
landmark role?  So far, i did not find such a requirement in the
WAI-ARIA-1.1 standard.  Did i miss it?  Or is that a constraint due
to some (or all) implementations of assistive technology software?

From the standards, quite to the contrary, i would expect that
most websites would have a site logo, a site name, and a search form
near the top of each page, and all three of these would go into
a <header> element.  So i would expect that <form role="search">
being on the top level would be the exception rather than the common
case.  What am i missing here?

[ two <header>s as children of the same element ]
> I think it's fine
> 1) in semantic sense (they are still headers and footers, just
>    page-specific ones)
> 2) so we can write "header > table" in CSS

OK, thanks for clarifyong that, so i'll use that if we end up
needing it.

[...]
>> Do you think having two consecutive headers right below <body> would
>> be good here, or what should we do instead?

> This won't happen with my proposal. Either this:
> 
> <form>
> <header>
>
> or this:
> 
> <form>
> <nav> (with <table class="results">)
> <header>

I see.  If we do not wrap the site-oriented information at the top (site name and search form) in a <header> element, then we only have one header.  It seems a bit strange in that case that the header isn't at the top, but maybe that's not a problem?

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-03 20:12       ` Ingo Schwarze
@ 2022-07-03 20:51         ` Anna “CyberTailor”
  2022-07-05 15:16           ` Ingo Schwarze
  0 siblings, 1 reply; 14+ messages in thread
From: Anna “CyberTailor” @ 2022-07-03 20:51 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

On 2022-07-03 22:12, Ingo Schwarze wrote:
> Hello Anna,
> 
> thank your for your explanations, i think i'm getting closer to
> understanding these things.  However, a few details still confuse me:
> 
> Anna Vyalkova wrote on Sun, Jul 03, 2022 at 11:49:47PM +0500:
> > On 2022-07-03 19:24, Ingo Schwarze wrote:
> 
> >> The table in question is clearly page-specific and definitely
> >> not the same for all documents on the site.  I really think we
> >> should better use the role "doc-pageheader" here and not "banner".
> 
> > Yes, this is according to the standards (and to common sense, since
> > these sections are not worth assigning landmark roles). However only a
> > few screen readers support "doc-pageheader" and "doc-pagefooter" roles,
> 
> Ouch.  Is there some way to find out (for a person like me who
> lacks experience with assistive technology) which ARIA features are
> well-supported across a wide range of assistive technology software
> and which tend to be poorly supported or unsupported by some software?

There are incomplete lists:
https://a11ysupport.io/
https://www.powermapper.com/tests/screen-readers/aria/

Key navigation features can be found in the documentation:
https://help.gnome.org/users/orca/stable/commands_structural_navigation.html.en
https://www.nvaccess.org/files/nvda/documentation/userGuide.html#BrowseMode

> 
> > so an 'aria-label' tag may be needed in addition to avoid confusion:
> > 
> >   <header role="doc-pageheader" aria-label="Manual header line">
> 
> Sure, we can do that.  Still, i am curious how exactly the aria-label
> attribute helps in this context.  As far as i understand, the
> aria-label is just a name (invisible to the eye) for an HTML element
> and doesn't imply anything about document structure.  What difference
> does it make for a screen reader whether the aria-label is present or
> absent?

It will say the line before entering the element.

> Why would a user ever want the words "Manual header line" read out at
> them?

To know what to expect (and decide whether to skip or not).

Using a screen reader is like reading through a straw and totally blind
users can't see the whole picture.

> >> We might of course consider using <header role="doc-pageheader">,
> >> but that would seem unfortunate to me because in the case of man.cgi(8)
> >> output, we really need the "banner" role (ideally getting it as the default
> >> from a header element) for the site name (e.g. "OpenBSD manual page server")
> >> and the search form ("Manual Page Search Parameters").  Using <header>
> >> for *that* would perfectly fit the definition of the "banner" role
> >> cited above.
> >> 
> >> As far as i can see, the HTML standard does not prohibit having two
> >> <header> elements in a row, for example like this:
> >> 
> >>   <body>
> >>     <header>
> >>       <h1><a href="https://www.openbsd.org/">OpenBSD</a>
> >>           manual page server</h1>
> 
> > If it's only one H1, assigning it a banner role makes little sense as
> > it's already reflected in the document hierarchy.
> 
> >>       <form action="/" method="get" autocomplete="off" autocapitalize="none">
> >>       ...
> >>       </form>
> 
> > The search form needs to be top-level with role="search" to be
> > considered as a landmark:
> 
> Yes, the form needs role="search", no doubt about that.
> 
> But why does the form need to be top-level in order to be assigned a
> landmark role?  So far, i did not find such a requirement in the
> WAI-ARIA-1.1 standard.  Did i miss it?  Or is that a constraint due
> to some (or all) implementations of assistive technology software?

Yes, there's no such requirement. I misinterpreted it. So wrapping the
form in <header> is fine.

> From the standards, quite to the contrary, i would expect that
> most websites would have a site logo, a site name, and a search form
> near the top of each page, and all three of these would go into
> a <header> element.  So i would expect that <form role="search">
> being on the top level would be the exception rather than the common
> case.  What am i missing here?

Yes, makes sense.

> [ two <header>s as children of the same element ]
> > I think it's fine
> > 1) in semantic sense (they are still headers and footers, just
> >    page-specific ones)
> > 2) so we can write "header > table" in CSS
> 
> OK, thanks for clarifyong that, so i'll use that if we end up
> needing it.
> 
> [...]
> >> Do you think having two consecutive headers right below <body> would
> >> be good here, or what should we do instead?
> 
> > This won't happen with my proposal. Either this:
> > 
> > <form>
> > <header>
> >
> > or this:
> > 
> > <form>
> > <nav> (with <table class="results">)
> > <header>
> 
> I see.  If we do not wrap the site-oriented information at the top (site name and search form) in a <header> element, then we only have one header.  It seems a bit strange in that case that the header isn't at the top, but maybe that's not a problem?
> 
> Yours,
>   Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-03 20:51         ` Anna “CyberTailor”
@ 2022-07-05 15:16           ` Ingo Schwarze
  2022-07-05 16:15             ` Anna
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Schwarze @ 2022-07-05 15:16 UTC (permalink / raw)
  To: Anna; +Cc: tech

Hello Anna,

Anna wrote on Mon, Jul 04, 2022 at 01:51:01AM +0500:

> There are incomplete lists:
> https://a11ysupport.io/
> https://www.powermapper.com/tests/screen-readers/aria/

Thanks, i linked those from https://mandoc.bsd.lv/links.html
to not forget them.

> On 2022-07-03 22:12, Ingo Schwarze wrote:

[...]
>> What difference does it make for a screen reader whether
>> the aria-label is present or absent?

> It will say the line before entering the element.

>> Why would a user ever want the words "Manual header line"
>> read out at them?

> To know what to expect (and decide whether to skip or not).

Fair enough, so we'll add such aria-label attributes where appropriate.

[...]
> Yes, there's no such requirement. I misinterpreted it. So wrapping the
> form in <header> is fine.

Done.  In addition, i also committed another patch to move
the <h1> site header typically contained in header.html
into the <header>.


Next, i drafted a patch to use <header> for the manual header line,
but it does not work, and i feel a bit at a loss now.  The version
of the patch appended below (also installed on man.bsd.lv for
testing) is deliberately inconsistent to demonstrate two ways
of writing the <header>.

For manuals in man(7) format, the patch implements the original idea,
so for example, https://man.bsd.lv/cvs.1 contains:

  <header role="doc-pageheader" aria-label="manual header line">
  <table class="head">
    <tr>
      <td class="head-ltitle">CVS(1)</td>
      <td class="head-vol">General Commands Manual</td>
      <td class="head-rtitle">CVS(1)</td>
    </tr>
  </table>
  </header>

But that is invalid code, see

  https://validator.w3.org/nu/?doc=https%3A%2F%2Fman.bsd.lv%2Fcvs.1

  Error: Bad value doc-pageheader for attribute role on element header.
  From line 171, column 1; to line 171, column 62

And indeed, https://www.w3.org/TR/html-aria/#docconformance says:

  HTML element: <header>
  ARIA roles which MAY be used: group, none or presentation. 

So we must not use doc-pageheader on <header>.

My next attempt was to move the ARIA information from the <header>
to the contained <table>.  For demonstration, i implemented that
for manuals in mdoc(7) format.  For example, https://man.bsd.lv/true.1
contains:

  <header role="group">
  <table role="doc-pageheader" aria-label="manual header line">
    <tr>
      <td class="head-ltitle">TRUE(1)</td>
      <td class="head-vol">General Commands Manual</td>
      <td class="head-rtitle">TRUE(1)</td>
    </tr>
  </table>
  </header>

But the validator complains anyway:

  https://validator.w3.org/nu/?doc=https%3A%2F%2Fman.bsd.lv%2Ftrue.1

  Error: Bad value doc-pageheader for attribute role on element table.
  From line 172, column 1; to line 172, column 61

I have no idea why; https://www.w3.org/TR/html-aria/#docconformance says:

  HTML element: <table>
  ARIA roles which MAY be used: Any role

The section https://www.w3.org/TR/html-aria/#allowed-descendants-of-aria-roles
does not appear to restrict the content of an element of role="group";
it allows any flow content.  I don't see anything
in https://www.w3.org/TR/dpub-aria-1.1/#doc-pageheader either
that might be violated.

Do you have an idea what might be wrong here, or how we could fix it?

If you have no idea either, i might just drop the <header> element
around the manual header line, like this:

  [...]
  </form>
  </header>
  <hr>
  <table role="doc-pageheader" aria-label="manual header line">
    <tr>
      <td class="head-ltitle">TRUE(1)</td>
      <td class="head-vol">General Commands Manual</td>
      <td class="head-rtitle">TRUE(1)</td>
    </tr>
  </table>
  <main class="manual-text">
  <section class="Sh">
  [...]

That looks syntactically and semantically correct to me,
and the validator doesn't complain about it either.

Yours,
  Ingo


Index: html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/html.c,v
retrieving revision 1.148
diff -u -p -r1.148 html.c
--- html.c	3 Jul 2022 14:28:26 -0000	1.148
+++ html.c	5 Jul 2022 14:06:10 -0000
@@ -1,7 +1,7 @@
 /* $OpenBSD: html.c,v 1.148 2022/07/03 14:28:26 schwarze Exp $ */
 /*
+ * Copyright (c) 2011-2015, 2017-2022 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -66,10 +66,12 @@ static	const struct htmldata htmltags[TA
 	{"style",	HTML_NLALL | HTML_INDENT},
 	{"title",	HTML_NLAROUND},
 	{"body",	HTML_NLALL},
+	{"header",	HTML_NLALL},
 	{"main",	HTML_NLALL},
 	{"div",		HTML_NLAROUND},
 	{"section",	HTML_NLALL},
 	{"nav",		HTML_NLALL},
+	{"footer",	HTML_NLALL},
 	{"table",	HTML_NLALL | HTML_INDENT},
 	{"tr",		HTML_NLALL | HTML_INDENT},
 	{"td",		HTML_NLAROUND},
Index: html.h
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/html.h,v
retrieving revision 1.73
diff -u -p -r1.73 html.h
--- html.h	3 Jul 2022 14:28:27 -0000	1.73
+++ html.h	5 Jul 2022 14:06:10 -0000
@@ -2,6 +2,7 @@
 /*
  * Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -27,10 +28,12 @@ enum	htmltag {
 	TAG_STYLE,
 	TAG_TITLE,
 	TAG_BODY,
+	TAG_HEADER,
 	TAG_MAIN,
 	TAG_DIV,
 	TAG_SECTION,
 	TAG_NAV,
+	TAG_FOOTER,
 	TAG_TABLE,
 	TAG_TR,
 	TAG_TD,
Index: man_html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/man_html.c,v
retrieving revision 1.134
diff -u -p -r1.134 man_html.c
--- man_html.c	4 Jul 2022 14:37:14 -0000	1.134
+++ man_html.c	5 Jul 2022 14:06:10 -0000
@@ -1,7 +1,8 @@
 /* $OpenBSD: man_html.c,v 1.134 2022/07/04 14:37:14 schwarze Exp $ */
 /*
- * Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013-2015,2017-2020,2022 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -268,7 +269,9 @@ man_root_pre(const struct roff_meta *man
 	assert(man->msec);
 	mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
 
-	t = print_otag(h, TAG_TABLE, "c", "head");
+	t = print_otag(h, TAG_HEADER, "r?", "doc-pageheader",
+		"aria-label", "manual header line");
+	print_otag(h, TAG_TABLE, "c", "head");
 	tt = print_otag(h, TAG_TR, "");
 
 	print_otag(h, TAG_TD, "c", "head-ltitle");
@@ -291,7 +294,9 @@ man_root_post(const struct roff_meta *ma
 {
 	struct tag	*t, *tt;
 
-	t = print_otag(h, TAG_TABLE, "c", "foot");
+	t = print_otag(h, TAG_FOOTER, "r?", "doc-pagefooter",
+		"aria-label", "manual footer line");
+	print_otag(h, TAG_TABLE, "c", "foot");
 	tt = print_otag(h, TAG_TR, "");
 
 	print_otag(h, TAG_TD, "c", "foot-date");
Index: mandoc.css
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mandoc.css,v
retrieving revision 1.37
diff -u -p -r1.37 mandoc.css
--- mandoc.css	3 Jul 2022 14:28:27 -0000	1.37
+++ mandoc.css	5 Jul 2022 14:06:10 -0000
@@ -53,7 +53,8 @@ table.results {	margin-top: 1em;
 
 /* Header and footer lines. */
 
-table.head {	width: 100%;
+header > table {
+		width: 100%;
 		border-bottom: 1px dotted #808080;
 		margin-bottom: 1em;
 		font-size: smaller; }
@@ -61,7 +62,8 @@ td.head-vol {	text-align: center; }
 td.head-rtitle {
 		text-align: right; }
 
-table.foot {	width: 100%;
+footer > table {
+		width: 100%;
 		border-top: 1px dotted #808080;
 		margin-top: 1em;
 		font-size: smaller; }
Index: mdoc_html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_html.c,v
retrieving revision 1.221
diff -u -p -r1.221 mdoc_html.c
--- mdoc_html.c	4 Jul 2022 14:37:14 -0000	1.221
+++ mdoc_html.c	5 Jul 2022 14:06:10 -0000
@@ -453,7 +453,9 @@ mdoc_root_post(const struct roff_meta *m
 {
 	struct tag	*t, *tt;
 
-	t = print_otag(h, TAG_TABLE, "c", "foot");
+	t = print_otag(h, TAG_FOOTER, "r", "group");
+	print_otag(h, TAG_TABLE, "r?", "doc-pagefooter",
+	    "aria-label", "manual footer line");
 	tt = print_otag(h, TAG_TR, "");
 
 	print_otag(h, TAG_TD, "c", "foot-date");
@@ -483,7 +485,9 @@ mdoc_root_pre(const struct roff_meta *me
 		mandoc_asprintf(&title, "%s(%s)",
 		    meta->title, meta->msec);
 
-	t = print_otag(h, TAG_TABLE, "c", "head");
+	t = print_otag(h, TAG_HEADER, "r", "group");
+	print_otag(h, TAG_TABLE, "r?", "doc-pageheader",
+	    "aria-label", "manual header line");
 	tt = print_otag(h, TAG_TR, "");
 
 	print_otag(h, TAG_TD, "c", "head-ltitle");
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-05 15:16           ` Ingo Schwarze
@ 2022-07-05 16:15             ` Anna
  2022-07-05 18:45               ` Ingo Schwarze
  0 siblings, 1 reply; 14+ messages in thread
From: Anna @ 2022-07-05 16:15 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

On 2022-07-05 17:16, Ingo Schwarze wrote:
> > Yes, there's no such requirement. I misinterpreted it. So wrapping the
> > form in <header> is fine.
> 
> Done.  In addition, i also committed another patch to move
> the <h1> site header typically contained in header.html
> into the <header>.
> 
> 
> Next, i drafted a patch to use <header> for the manual header line,
> but it does not work, and i feel a bit at a loss now.  The version
> of the patch appended below (also installed on man.bsd.lv for
> testing) is deliberately inconsistent to demonstrate two ways
> of writing the <header>.
> 
> For manuals in man(7) format, the patch implements the original idea,
> so for example, https://man.bsd.lv/cvs.1 contains:
> 
>   <header role="doc-pageheader" aria-label="manual header line">
>   <table class="head">
>     <tr>
>       <td class="head-ltitle">CVS(1)</td>
>       <td class="head-vol">General Commands Manual</td>
>       <td class="head-rtitle">CVS(1)</td>
>     </tr>
>   </table>
>   </header>
> 
> But that is invalid code, see
> 
>   https://validator.w3.org/nu/?doc=https%3A%2F%2Fman.bsd.lv%2Fcvs.1
> 
>   Error: Bad value doc-pageheader for attribute role on element header.
>   From line 171, column 1; to line 171, column 62
> 
> And indeed, https://www.w3.org/TR/html-aria/#docconformance says:
> 
>   HTML element: <header>
>   ARIA roles which MAY be used: group, none or presentation. 

Same with footer.

> So we must not use doc-pageheader on <header>.
> 
> My next attempt was to move the ARIA information from the <header>
> to the contained <table>.  For demonstration, i implemented that
> for manuals in mdoc(7) format.  For example, https://man.bsd.lv/true.1
> contains:
> 
>   <header role="group">
>   <table role="doc-pageheader" aria-label="manual header line">
>     <tr>
>       <td class="head-ltitle">TRUE(1)</td>
>       <td class="head-vol">General Commands Manual</td>
>       <td class="head-rtitle">TRUE(1)</td>
>     </tr>
>   </table>
>   </header>
> 
> But the validator complains anyway:
> 
>   https://validator.w3.org/nu/?doc=https%3A%2F%2Fman.bsd.lv%2Ftrue.1
> 
>   Error: Bad value doc-pageheader for attribute role on element table.
>   From line 172, column 1; to line 172, column 61
> 
> I have no idea why; https://www.w3.org/TR/html-aria/#docconformance says:
> 
>   HTML element: <table>
>   ARIA roles which MAY be used: Any role
> 
> The section https://www.w3.org/TR/html-aria/#allowed-descendants-of-aria-roles
> does not appear to restrict the content of an element of role="group";
> it allows any flow content.  I don't see anything
> in https://www.w3.org/TR/dpub-aria-1.1/#doc-pageheader either
> that might be violated.
> 
> Do you have an idea what might be wrong here, or how we could fix it?
> 
> If you have no idea either, i might just drop the <header> element
> around the manual header line, like this:
> 
>   [...]
>   </form>
>   </header>
>   <hr>
>   <table role="doc-pageheader" aria-label="manual header line">
>     <tr>
>       <td class="head-ltitle">TRUE(1)</td>
>       <td class="head-vol">General Commands Manual</td>
>       <td class="head-rtitle">TRUE(1)</td>
>     </tr>
>   </table>
>   <main class="manual-text">
>   <section class="Sh">
>   [...]
> 
> That looks syntactically and semantically correct to me,
> and the validator doesn't complain about it either.

Whatever works (but then we need to keep class="head" for styles).

While we're at this, can we use something other than tables for
pageheader/pagefooter layout?
https://git.sr.ht/~devinprater/fossability/tree/master/item/user%20interface%20and%20experience/web.md#html

> Yours,
>   Ingo
> 
> 
> Index: html.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/html.c,v
> retrieving revision 1.148
> diff -u -p -r1.148 html.c
> --- html.c	3 Jul 2022 14:28:26 -0000	1.148
> +++ html.c	5 Jul 2022 14:06:10 -0000
> @@ -1,7 +1,7 @@
>  /* $OpenBSD: html.c,v 1.148 2022/07/03 14:28:26 schwarze Exp $ */
>  /*
> + * Copyright (c) 2011-2015, 2017-2022 Ingo Schwarze <schwarze@openbsd.org>
>   * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
> - * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
>   * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
>   *
>   * Permission to use, copy, modify, and distribute this software for any
> @@ -66,10 +66,12 @@ static	const struct htmldata htmltags[TA
>  	{"style",	HTML_NLALL | HTML_INDENT},
>  	{"title",	HTML_NLAROUND},
>  	{"body",	HTML_NLALL},
> +	{"header",	HTML_NLALL},
>  	{"main",	HTML_NLALL},
>  	{"div",		HTML_NLAROUND},
>  	{"section",	HTML_NLALL},
>  	{"nav",		HTML_NLALL},
> +	{"footer",	HTML_NLALL},
>  	{"table",	HTML_NLALL | HTML_INDENT},
>  	{"tr",		HTML_NLALL | HTML_INDENT},
>  	{"td",		HTML_NLAROUND},
> Index: html.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/html.h,v
> retrieving revision 1.73
> diff -u -p -r1.73 html.h
> --- html.h	3 Jul 2022 14:28:27 -0000	1.73
> +++ html.h	5 Jul 2022 14:06:10 -0000
> @@ -2,6 +2,7 @@
>  /*
>   * Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
>   * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
> + * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
>   *
>   * Permission to use, copy, modify, and distribute this software for any
>   * purpose with or without fee is hereby granted, provided that the above
> @@ -27,10 +28,12 @@ enum	htmltag {
>  	TAG_STYLE,
>  	TAG_TITLE,
>  	TAG_BODY,
> +	TAG_HEADER,
>  	TAG_MAIN,
>  	TAG_DIV,
>  	TAG_SECTION,
>  	TAG_NAV,
> +	TAG_FOOTER,
>  	TAG_TABLE,
>  	TAG_TR,
>  	TAG_TD,
> Index: man_html.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/man_html.c,v
> retrieving revision 1.134
> diff -u -p -r1.134 man_html.c
> --- man_html.c	4 Jul 2022 14:37:14 -0000	1.134
> +++ man_html.c	5 Jul 2022 14:06:10 -0000
> @@ -1,7 +1,8 @@
>  /* $OpenBSD: man_html.c,v 1.134 2022/07/04 14:37:14 schwarze Exp $ */
>  /*
> - * Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
> + * Copyright (c) 2013-2015,2017-2020,2022 Ingo Schwarze <schwarze@openbsd.org>
>   * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
> + * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
>   *
>   * Permission to use, copy, modify, and distribute this software for any
>   * purpose with or without fee is hereby granted, provided that the above
> @@ -268,7 +269,9 @@ man_root_pre(const struct roff_meta *man
>  	assert(man->msec);
>  	mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
>  
> -	t = print_otag(h, TAG_TABLE, "c", "head");
> +	t = print_otag(h, TAG_HEADER, "r?", "doc-pageheader",
> +		"aria-label", "manual header line");
> +	print_otag(h, TAG_TABLE, "c", "head");
>  	tt = print_otag(h, TAG_TR, "");
>  
>  	print_otag(h, TAG_TD, "c", "head-ltitle");
> @@ -291,7 +294,9 @@ man_root_post(const struct roff_meta *ma
>  {
>  	struct tag	*t, *tt;
>  
> -	t = print_otag(h, TAG_TABLE, "c", "foot");
> +	t = print_otag(h, TAG_FOOTER, "r?", "doc-pagefooter",
> +		"aria-label", "manual footer line");
> +	print_otag(h, TAG_TABLE, "c", "foot");
>  	tt = print_otag(h, TAG_TR, "");
>  
>  	print_otag(h, TAG_TD, "c", "foot-date");
> Index: mandoc.css
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/mandoc.css,v
> retrieving revision 1.37
> diff -u -p -r1.37 mandoc.css
> --- mandoc.css	3 Jul 2022 14:28:27 -0000	1.37
> +++ mandoc.css	5 Jul 2022 14:06:10 -0000
> @@ -53,7 +53,8 @@ table.results {	margin-top: 1em;
>  
>  /* Header and footer lines. */
>  
> -table.head {	width: 100%;
> +header > table {
> +		width: 100%;
>  		border-bottom: 1px dotted #808080;
>  		margin-bottom: 1em;
>  		font-size: smaller; }
> @@ -61,7 +62,8 @@ td.head-vol {	text-align: center; }
>  td.head-rtitle {
>  		text-align: right; }
>  
> -table.foot {	width: 100%;
> +footer > table {
> +		width: 100%;
>  		border-top: 1px dotted #808080;
>  		margin-top: 1em;
>  		font-size: smaller; }
> Index: mdoc_html.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/mdoc_html.c,v
> retrieving revision 1.221
> diff -u -p -r1.221 mdoc_html.c
> --- mdoc_html.c	4 Jul 2022 14:37:14 -0000	1.221
> +++ mdoc_html.c	5 Jul 2022 14:06:10 -0000
> @@ -453,7 +453,9 @@ mdoc_root_post(const struct roff_meta *m
>  {
>  	struct tag	*t, *tt;
>  
> -	t = print_otag(h, TAG_TABLE, "c", "foot");
> +	t = print_otag(h, TAG_FOOTER, "r", "group");
> +	print_otag(h, TAG_TABLE, "r?", "doc-pagefooter",
> +	    "aria-label", "manual footer line");
>  	tt = print_otag(h, TAG_TR, "");
>  
>  	print_otag(h, TAG_TD, "c", "foot-date");
> @@ -483,7 +485,9 @@ mdoc_root_pre(const struct roff_meta *me
>  		mandoc_asprintf(&title, "%s(%s)",
>  		    meta->title, meta->msec);
>  
> -	t = print_otag(h, TAG_TABLE, "c", "head");
> +	t = print_otag(h, TAG_HEADER, "r", "group");
> +	print_otag(h, TAG_TABLE, "r?", "doc-pageheader",
> +	    "aria-label", "manual header line");
>  	tt = print_otag(h, TAG_TR, "");
>  
>  	print_otag(h, TAG_TD, "c", "head-ltitle");
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-05 16:15             ` Anna
@ 2022-07-05 18:45               ` Ingo Schwarze
  2022-07-05 19:03                 ` Anna
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Schwarze @ 2022-07-05 18:45 UTC (permalink / raw)
  To: Anna; +Cc: tech

Hi Anna,

Anna wrote on Tue, Jul 05, 2022 at 09:15:48PM +0500:

> Whatever works

Not really...  :-(
I have seen that attitude result in terrible markup too often,
and not only in HTML/CSS, but also in other markup languages
like mdoc(7), man(7), roff(7), even LaTeX...

So i would really like to select markup that makes sense semantically
and is also generally considered as decent style.

> (but then we need to keep class="head" for styles).

Not necessarily.  CSS can also select by other attributes.
For example, mandoc.css already contains

  input[name=expr] { width: 25%; }

Maybe we could do something like:

  table[role=doc-pageheader] { ... }

Then again, maybe nothing much is wrong with keeping the class for
backward compatibility, at least for some time.

> While we're at this, can we use something other than tables for
> pageheader/pagefooter layout?
> https://git.sr.ht/~devinprater/fossability/tree/master/item/user%20interface%20and%20experience/web.md#html

Yes, i'm aware of that, and i have been wanting to move away from
this abuse of <table> for several years but never came round to it.

There is also this very old entry in the TODO file:

 - The tables used to render the three-part page headers actually force
   the width of the <body> to the max-width given for <html>.
   Not yet sure how to fix that...
   Observed by an Anonymous Coward on undeadly.org:
   http://undeadly.org/cgi?action=article&sid=20140925064244&pid=1
   loc *  exist *  algo **  size *  imp ***

That might possibly fix itself once we move away from <table>.

In the context of your patches, i deliberately avoided bringing
that up because i didn't want to cause a distraction from your work.

Then again, since you bring it up, maybe we should fix this first.
With a bit of luck, it might make assigning the proper ARIA
role easier, too.

So, which HTML element *should* we use instead of <table>?
<header> would make sense from the semantic perspective but
we already found out we cannot assign the doc-pageheader role to it.
<section> seems clearly inappropriate.
That leaves me more or less with <div>, but that is very weak
semantically...

And then the second question is how to style it.
Do you think flexbox is the right CSS tool,
or is there something that might fit better?

Right now, the best i can come up with is

<header role="group"> /* or without this if the validator complains again */
<div role="doc-pageheader" aria-label="manual header line">
  <span>CHMOD(1)</span>
  <span>General Commands Manual</span>
  <span>CHMOD(1)</span>
</div>
</header>

div[role=doc-pageheader] {
	display: flex;
	justify-content: space-between;
	border-bottom: 1px dotted #808080;
	margin-bottom: 1em;
	font-size: smaller; }

Not tested yet!  Do you have a better idea, or should i develop
a patch for that, test it, and commit it if it works?

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-05 18:45               ` Ingo Schwarze
@ 2022-07-05 19:03                 ` Anna
  2022-07-05 21:39                   ` Ingo Schwarze
  0 siblings, 1 reply; 14+ messages in thread
From: Anna @ 2022-07-05 19:03 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

On 2022-07-05 20:45, Ingo Schwarze wrote:
> Hi Anna,
> 
> Anna wrote on Tue, Jul 05, 2022 at 09:15:48PM +0500:
> 
> > Whatever works
> 
> Not really...  :-(
> I have seen that attitude result in terrible markup too often,
> and not only in HTML/CSS, but also in other markup languages
> like mdoc(7), man(7), roff(7), even LaTeX...
> 
> So i would really like to select markup that makes sense semantically
> and is also generally considered as decent style.
> 
> > (but then we need to keep class="head" for styles).
> 
> Not necessarily.  CSS can also select by other attributes.
> For example, mandoc.css already contains
> 
>   input[name=expr] { width: 25%; }
> 
> Maybe we could do something like:
> 
>   table[role=doc-pageheader] { ... }
> 
> Then again, maybe nothing much is wrong with keeping the class for
> backward compatibility, at least for some time.
> 
> > While we're at this, can we use something other than tables for
> > pageheader/pagefooter layout?
> > https://git.sr.ht/~devinprater/fossability/tree/master/item/user%20interface%20and%20experience/web.md#html
> 
> Yes, i'm aware of that, and i have been wanting to move away from
> this abuse of <table> for several years but never came round to it.
> 
> There is also this very old entry in the TODO file:
> 
>  - The tables used to render the three-part page headers actually force
>    the width of the <body> to the max-width given for <html>.
>    Not yet sure how to fix that...
>    Observed by an Anonymous Coward on undeadly.org:
>    http://undeadly.org/cgi?action=article&sid=20140925064244&pid=1
>    loc *  exist *  algo **  size *  imp ***
> 
> That might possibly fix itself once we move away from <table>.
> 
> In the context of your patches, i deliberately avoided bringing
> that up because i didn't want to cause a distraction from your work.
> 
> Then again, since you bring it up, maybe we should fix this first.
> With a bit of luck, it might make assigning the proper ARIA
> role easier, too.
> 
> So, which HTML element *should* we use instead of <table>?
> <header> would make sense from the semantic perspective but
> we already found out we cannot assign the doc-pageheader role to it.
> <section> seems clearly inappropriate.
> That leaves me more or less with <div>, but that is very weak
> semantically...

<header> is just <div> with default role, so there's nothing wrong in
using <div>.
 
> And then the second question is how to style it.
> Do you think flexbox is the right CSS tool,
> or is there something that might fit better?

I thought about flexbox too, it is the right tool.

> Right now, the best i can come up with is
> 
> <header role="group"> /* or without this if the validator complains again */
> <div role="doc-pageheader" aria-label="manual header line">
>   <span>CHMOD(1)</span>
>   <span>General Commands Manual</span>
>   <span>CHMOD(1)</span>
> </div>
> </header>

Maybe drop <header>. And leave classes for backwards compatibility with
user CSS.

> div[role=doc-pageheader] {
> 	display: flex;
> 	justify-content: space-between;
> 	border-bottom: 1px dotted #808080;
> 	margin-bottom: 1em;
> 	font-size: smaller; }
> 
> Not tested yet!  Do you have a better idea, or should i develop
> a patch for that, test it, and commit it if it works?

I have no better ideas.

> Yours,
>   Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] Wrap manual header in the "<header>" tag
  2022-07-05 19:03                 ` Anna
@ 2022-07-05 21:39                   ` Ingo Schwarze
  0 siblings, 0 replies; 14+ messages in thread
From: Ingo Schwarze @ 2022-07-05 21:39 UTC (permalink / raw)
  To: Anna; +Cc: tech

Hello Anna,

Anna wrote on Wed, Jul 06, 2022 at 12:03:15AM +0500:
> On 2022-07-05 20:45, Ingo Schwarze wrote:

[...]
> <header> is just <div> with default role, so there's nothing wrong in
> using <div>.
[...]
> I thought about flexbox too, it is the right tool.
[...]
> Maybe drop <header>. And leave classes for backwards compatibility with
> user CSS.

Thanks for all your feedback!  :-)

So in order to speed up progress, i just committed the patch appended
below, for now.  If we find ways to improve it further, we can always
do that in the tree.

The latest code is also installed on man.bsd.lv .

https://validator.w3.org/nu/?doc=https%3A%2F%2Fman.bsd.lv%2Ftrue.1

still complains about doc-pageheader, but i really don't see what
might be wrong there, and i now suspect that the validator simply
does not support doc-pageheader yet.  If anyone knows more, please
tell me!

Yours,
  Ingo


Log Message:
-----------
Finally get rid of the archaic <table> markup for header and footer lines 
and use flexbox CSS instead.  Improve accessibility by adding role 
and aria-label attributes to these header and footer lines.
Using ideas from both Anna Vyalkova <cyber at sysrq dot in> and myself.

As a welcome side effect, this also resolves the long-standing issue
that the rendering was always 65em wide, requiring horizontal scrolling
when the window was narrower.  Now, rendering nicely adapts to browser
windows of arbitrary narrowness.

Modified Files:
--------------
    mandoc:
        TODO
        man_html.c
        mandoc.css
        mdoc_html.c

Revision Data
-------------
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v
retrieving revision 1.346
retrieving revision 1.347
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.346 -r1.347
--- mdoc_html.c
+++ mdoc_html.c
@@ -453,16 +453,19 @@ print_mdoc_node(MDOC_ARGS)
 static void
 mdoc_root_post(const struct roff_meta *meta, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*t;
 
-	t = print_otag(h, TAG_TABLE, "c", "foot");
-	tt = print_otag(h, TAG_TR, "");
+	t = print_otag(h, TAG_DIV, "cr?", "foot", "doc-pagefooter",
+	    "aria-label", "manual footer line");
 
-	print_otag(h, TAG_TD, "c", "foot-date");
+	print_otag(h, TAG_SPAN, "c", "foot-left");
+	print_stagq(h, t);
+
+	print_otag(h, TAG_SPAN, "c", "foot-date");
 	print_text(h, meta->date);
-	print_stagq(h, tt);
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "foot-os");
+	print_otag(h, TAG_SPAN, "c", "foot-os");
 	print_text(h, meta->os);
 	print_tagq(h, t);
 }
@@ -470,7 +473,7 @@ mdoc_root_post(const struct roff_meta *m
 static int
 mdoc_root_pre(const struct roff_meta *meta, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*t;
 	char		*volume, *title;
 
 	if (NULL == meta->arch)
@@ -485,18 +488,18 @@ mdoc_root_pre(const struct roff_meta *me
 		mandoc_asprintf(&title, "%s(%s)",
 		    meta->title, meta->msec);
 
-	t = print_otag(h, TAG_TABLE, "c", "head");
-	tt = print_otag(h, TAG_TR, "");
+	t = print_otag(h, TAG_DIV, "cr?", "head", "doc-pageheader",
+	    "aria-label", "manual header line");
 
-	print_otag(h, TAG_TD, "c", "head-ltitle");
+	print_otag(h, TAG_SPAN, "c", "head-ltitle");
 	print_text(h, title);
-	print_stagq(h, tt);
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "head-vol");
+	print_otag(h, TAG_SPAN, "c", "head-vol");
 	print_text(h, volume);
-	print_stagq(h, tt);
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "head-rtitle");
+	print_otag(h, TAG_SPAN, "c", "head-rtitle");
 	print_text(h, title);
 	print_tagq(h, t);
 
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -Lman_html.c -Lman_html.c -u -p -r1.181 -r1.182
--- man_html.c
+++ man_html.c
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*
- * Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013-2015,2017-2020,2022 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -263,26 +263,26 @@ print_man_node(MAN_ARGS)
 static void
 man_root_pre(const struct roff_meta *man, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*t;
 	char		*title;
 
 	assert(man->title);
 	assert(man->msec);
 	mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
 
-	t = print_otag(h, TAG_TABLE, "c", "head");
-	tt = print_otag(h, TAG_TR, "");
+	t = print_otag(h, TAG_DIV, "cr?", "head", "doc-pageheader",
+	    "aria-label", "manual header line");
 
-	print_otag(h, TAG_TD, "c", "head-ltitle");
+	print_otag(h, TAG_SPAN, "c", "head-ltitle");
 	print_text(h, title);
-	print_stagq(h, tt);
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "head-vol");
+	print_otag(h, TAG_SPAN, "c", "head-vol");
 	if (man->vol != NULL)
 		print_text(h, man->vol);
-	print_stagq(h, tt);
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "head-rtitle");
+	print_otag(h, TAG_SPAN, "c", "head-rtitle");
 	print_text(h, title);
 	print_tagq(h, t);
 	free(title);
@@ -291,16 +291,19 @@ man_root_pre(const struct roff_meta *man
 static void
 man_root_post(const struct roff_meta *man, struct html *h)
 {
-	struct tag	*t, *tt;
+	struct tag	*t;
+
+	t = print_otag(h, TAG_DIV, "cr?", "foot", "doc-pagefooter",
+	    "aria-label", "manual footer line");
 
-	t = print_otag(h, TAG_TABLE, "c", "foot");
-	tt = print_otag(h, TAG_TR, "");
+	print_otag(h, TAG_SPAN, "c", "foot-left");
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "foot-date");
+	print_otag(h, TAG_SPAN, "c", "foot-date");
 	print_text(h, man->date);
-	print_stagq(h, tt);
+	print_stagq(h, t);
 
-	print_otag(h, TAG_TD, "c", "foot-os");
+	print_otag(h, TAG_SPAN, "c", "foot-os");
 	if (man->os != NULL)
 		print_text(h, man->os);
 	print_tagq(h, t);
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/mandoc/TODO,v
retrieving revision 1.325
retrieving revision 1.326
diff -LTODO -LTODO -u -p -r1.325 -r1.326
--- TODO
+++ TODO
@@ -538,13 +538,6 @@ are mere guesses, and some may be wrong.
   does this affect other characters, other source macros...?
   Jackson Pauls  29 Aug 2017 16:56:27 +0100
 
-- The tables used to render the three-part page headers actually force
-  the width of the <body> to the max-width given for <html>.
-  Not yet sure how to fix that...
-  Observed by an Anonymous Coward on undeadly.org:
-  http://undeadly.org/cgi?action=article&sid=20140925064244&pid=1
-  loc *  exist *  algo **  size *  imp ***
-
 - generate <img> tags in HTML
   idea from florian@  Tue, 7 Apr 2015 00:26:28 +0000
   may be possible to implement with .Lk img://something.png alt_text
Index: mandoc.css
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v
retrieving revision 1.50
retrieving revision 1.51
diff -Lmandoc.css -Lmandoc.css -u -p -r1.50 -r1.51
--- mandoc.css
+++ mandoc.css
@@ -53,19 +53,28 @@ table.results {	margin-top: 1em;
 
 /* Header and footer lines. */
 
-table.head {	width: 100%;
+div[role=doc-pageheader] {
+		display: flex;
 		border-bottom: 1px dotted #808080;
 		margin-bottom: 1em;
 		font-size: smaller; }
-td.head-vol {	text-align: center; }
-td.head-rtitle {
+.head-ltitle {	flex: 1; }
+.head-vol {	flex: 0 1 auto;
+		text-align: center; }
+.head-rtitle {	flex: 1;
 		text-align: right; }
 
-table.foot {	width: 100%;
+div[role=doc-pagefooter] {
+		display: flex;
+		justify-content: space-between;
 		border-top: 1px dotted #808080;
 		margin-top: 1em;
 		font-size: smaller; }
-td.foot-os {	text-align: right; }
+.foot-left {	flex: 1; }
+.foot-date {	flex: 0 1 auto;
+		text-align: center; }
+.foot-os {	flex: 1;
+		text-align: right; }
 
 /* Sections and paragraphs. */
 
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-07-05 21:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 18:18 [PATCH 0/3] Add HTML landmarks Anna Vyalkova
2022-06-28 18:18 ` [PATCH 1/3] Wrap manual header in the "<header>" tag Anna Vyalkova
2022-07-03 17:24   ` Ingo Schwarze
2022-07-03 18:49     ` Anna Vyalkova
2022-07-03 20:12       ` Ingo Schwarze
2022-07-03 20:51         ` Anna “CyberTailor”
2022-07-05 15:16           ` Ingo Schwarze
2022-07-05 16:15             ` Anna
2022-07-05 18:45               ` Ingo Schwarze
2022-07-05 19:03                 ` Anna
2022-07-05 21:39                   ` Ingo Schwarze
2022-06-28 18:18 ` [PATCH 2/3] Wrap manual text in the "<main>" tag Anna Vyalkova
2022-07-03 14:41   ` Ingo Schwarze
2022-06-28 18:18 ` [PATCH 3/3] Wrap manual footer in the "<footer>" tag Anna Vyalkova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).