Skip to content

Commit 4a13568

Browse files
committed
Profile page accessibility, other nits
1 parent 5e968ea commit 4a13568

File tree

7 files changed

+103
-46
lines changed

7 files changed

+103
-46
lines changed

lib/ht.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ static function hidden_default_submit($name, $value = null, $js = null) {
372372
}
373373
$js["class"] = trim(($js["class"] ?? "") . " pseudohidden");
374374
$js["value"] = $value;
375+
$js["aria-hidden"] = "true";
376+
$js["tabindex"] = -1;
375377
return self::submit($name, "", $js);
376378
}
377379

src/componentset.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class ComponentSet {
2828
/** @var string */
2929
private $_section_class = "";
3030
/** @var string */
31+
private $_next_section_tag = "";
32+
/** @var string */
3133
private $_next_section_class = "";
3234
/** @var string */
3335
private $_title_class = "";
@@ -384,6 +386,13 @@ function print_on_leave($name) {
384386
return $this->on_leave([$this, "print"], $name);
385387
}
386388

389+
/** @param string $tag
390+
* @return $this */
391+
function set_section_tag($tag) {
392+
$this->_next_section_tag = $tag;
393+
return $this;
394+
}
395+
387396
/** @param string $classes
388397
* @return $this */
389398
function add_section_class($classes) {
@@ -403,22 +412,32 @@ function add_title_class($classes) {
403412
function print_start_section($title = null, $hashid = null) {
404413
$title = $title ?? "";
405414
$hashid_notitle = $title === "" && (string) $hashid !== "";
415+
$tag = $this->_next_section_tag ? : "div";
406416
$this->print_end_section();
407417
$this->trigger_separator();
408-
if ($this->_next_section_class !== "" || $hashid_notitle) {
409-
echo '<div';
418+
if ($this->_next_section_tag !== ""
419+
|| $this->_next_section_class !== ""
420+
|| $hashid_notitle) {
421+
echo "<{$tag}";
410422
if ($this->_next_section_class !== "") {
411423
echo " class=\"", $this->_next_section_class, "\"";
412424
}
413-
$this->_next_section_class = $this->_section_class;
414425
if ($hashid_notitle) {
415426
echo " id=\"", htmlspecialchars($hashid), "\"";
416427
}
417428
echo '>';
418-
$this->_section_closer = "</div>";
429+
$this->_section_closer = "</{$tag}>";
430+
$this->_next_section_tag = "";
431+
$this->_next_section_class = $this->_section_class;
419432
}
420433
if ($title !== "") {
434+
if ($tag === "fieldset") {
435+
echo "<legend>";
436+
}
421437
$this->print_title($title, $hashid);
438+
if ($tag === "fieldset") {
439+
echo "</legend>";
440+
}
422441
}
423442
}
424443

@@ -446,7 +465,7 @@ function print_title($ftext, $hashid = null) {
446465
if ((string) $hashid !== "") {
447466
echo ' id="', htmlspecialchars($hashid), '"';
448467
}
449-
echo '>', Ftext::as(5, $ftext, 0), "</h3>\n";
468+
echo '>', Ftext::as(5, $ftext, 0), "</h3>";
450469
}
451470

452471
/** @param string $ftext

src/pages/p_home.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function print_search(Contact $user, Qrequest $qreq, ComponentSet $gx) {
208208
$limits = PaperSearch::viewable_limits($user);
209209
echo '<div class="homegrp d-table" id="homelist">',
210210
$this->print_h2_home('<a class="q" href="' . $this->conf->hoturl("search") . '" id="homesearch-label">Search</a>'),
211-
Ht::form($this->conf->hoturl("search"), ["method" => "get", "class" => "form-basic-search"]),
211+
Ht::form($this->conf->hoturl("search"), ["method" => "get", "class" => "form-basic-search", "role" => "search"]),
212212
Ht::entry("q", (string) $qreq->q, [
213213
"id" => "homeq", "size" => 32,
214214
"title" => "Enter paper numbers or search terms",

src/pages/p_profile.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,12 @@ function print() {
674674
echo '<div id="foldaccount" class="';
675675
if ($this->qreq->pctype === "chair"
676676
|| $this->qreq->pctype === "pc"
677-
|| (!isset($this->qreq->pctype) && ($this->user->roles & Contact::ROLE_PC) !== 0)) {
677+
|| (!isset($this->qreq->pctype)
678+
&& ($this->user->roles & Contact::ROLE_PC) !== 0)) {
678679
echo "fold1o fold2o";
679680
} else if ($this->qreq->ass
680-
|| (!isset($this->qreq->pctype) && ($this->user->roles & Contact::ROLE_ADMIN) !== 0)) {
681+
|| (!isset($this->qreq->pctype)
682+
&& ($this->user->roles & Contact::ROLE_ADMIN) !== 0)) {
681683
echo "fold1c fold2o";
682684
} else {
683685
echo "fold1c fold2c";

src/pages/p_search.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ function print($qreq) {
337337
echo '<div class="tld is-tla',
338338
$this->stab === "default" ? " active" : "",
339339
'" id="default" role="tabpanel" aria-labelledby="k-default-tab">',
340-
Ht::form($this->conf->hoturl("search"), ["method" => "get", "class" => "form-basic-search"]),
340+
Ht::form($this->conf->hoturl("search"), ["method" => "get", "class" => "form-basic-search", "role" => "search"]),
341341
Ht::entry("q", (string) $qreq->q, [
342342
"size" => 40, "tabindex" => 1,
343343
"class" => "papersearch want-focus need-suggest flex-grow-1",
@@ -353,7 +353,7 @@ function print($qreq) {
353353
echo '<div class="tld is-tla',
354354
$this->stab === "advanced" ? " active" : "",
355355
'" id="advanced" role="tabpanel" aria-labelledby="k-advanced-tab">',
356-
Ht::form($this->conf->hoturl("search"), ["method" => "get"]),
356+
Ht::form($this->conf->hoturl("search"), ["method" => "get", "role" => "search"]),
357357
'<div class="d-inline-block">',
358358
'<div class="entryi medium"><label for="k-advanced-qt">Search</label><div class="entry">',
359359
Ht::select("qt", $qtOpt, $qreq->qt ?? "n", ["id" => "k-advanced-qt"]),

src/userstatus.php

Lines changed: 63 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,17 +1594,17 @@ function print_main_email() {
15941594
}
15951595
$this->print_field("uemail", "Email" . $this->actas_link(),
15961596
Ht::entry("uemail", $this->qreq->uemail ?? $this->qreq->email ?? "", ["class" => $class, "size" => 52, "id" => "uemail", "autocomplete" => $this->autocomplete("username"), "data-default-value" => "", "type" => "email"]));
1597+
return;
1598+
}
1599+
if (Contact::session_index_by_email($this->qreq->qsession(), $this->user->email) >= 0) {
1600+
$link = "<p class=\"nearby\">" . Ht::link("Manage email →", $this->conf->hoturl("manageemail", ["u" => $this->user->email]), ["class" => "btn btn-success btn-sm"]) . "</p>";
1601+
} else if ($this->viewer->privChair && $this->user->is_reviewer()) {
1602+
$link = "<p class=\"nearby\">" . Ht::link("Transfer reviews →", $this->conf->hoturl("manageemail", ["t" => "transferreview", "u" => $this->user->email]), ["class" => "btn btn-primary btn-sm"]) . "</p>";
15971603
} else {
1598-
if (Contact::session_index_by_email($this->qreq->qsession(), $this->user->email) >= 0) {
1599-
$link = "<p class=\"nearby\">" . Ht::link("Manage email →", $this->conf->hoturl("manageemail", ["u" => $this->user->email]), ["class" => "btn btn-success btn-sm"]) . "</p>";
1600-
} else if ($this->viewer->privChair && $this->user->is_reviewer()) {
1601-
$link = "<p class=\"nearby\">" . Ht::link("Transfer reviews →", $this->conf->hoturl("manageemail", ["t" => "transferreview", "u" => $this->user->email]), ["class" => "btn btn-primary btn-sm"]) . "</p>";
1602-
} else {
1603-
$link = "";
1604-
}
1605-
$this->print_field("uemail", "Email" . $this->actas_link(),
1606-
"<p><strong class=\"sb\">" . htmlspecialchars($this->user->email) . "</strong></p>{$link}");
1604+
$link = "";
16071605
}
1606+
$this->print_field(null, "Email" . $this->actas_link(),
1607+
"<p><strong class=\"sb\">" . htmlspecialchars($this->user->email) . "</strong></p>{$link}");
16081608
}
16091609

16101610
function print_main_external_username() {
@@ -1685,6 +1685,7 @@ static function print_roles(UserStatus $us) {
16851685
return;
16861686
}
16871687

1688+
$us->cs()->set_section_tag("fieldset");
16881689
$us->print_start_section("Roles", "roles");
16891690

16901691
if ($us->user->security_locked_here()) {
@@ -1750,7 +1751,7 @@ static function print_collaborators(UserStatus $us) {
17501751
}
17511752
$cd = $us->conf->_i("conflictdef");
17521753
$us->cs()->add_section_class("w-text")->print_start_section();
1753-
echo '<h3 class="', $us->control_class("collaborators", "form-h field-title"), '">Collaborators and other affiliations</h3>', "\n",
1754+
echo '<h3 class="', $us->control_class("collaborators", "form-h field-title"), '"><label for="collaborators">Collaborators and other affiliations</label></h3>', "\n",
17541755
"<p>List potential conflicts of interest one per line, using parentheses for affiliations and institutions. We may use this information when assigning reviews.<br>Examples: “Ping Yen Zhang (INRIA)”, “All (University College London)”</p>";
17551756
if ($cd !== "" && preg_match('/<(?:p|div)[ >]/', $cd)) {
17561757
echo $cd;
@@ -1771,63 +1772,91 @@ static function print_topics(UserStatus $us) {
17711772
&& !$us->viewer->privChair) {
17721773
return;
17731774
}
1774-
$us->cs()->add_section_class("w-text fx1")->print_start_section("Topic interests");
1775+
$us->cs()->add_section_class("w-text fx1")
1776+
->set_section_tag("fieldset")
1777+
->print_start_section("Topic interests");
1778+
1779+
$ibound = [-INF, -1.5, -0.5, 0.5, 1.5, INF];
1780+
$labels = ["Very low interest", "Low interest", "Standard interest", "High interest", "Very high interest"];
1781+
17751782
echo '<p>Please indicate your interest in reviewing papers on these conference
17761783
topics. We use this information to help match papers to reviewers.</p>',
17771784
Ht::hidden("has_ti", 1),
17781785
$us->feedback_html_at("ti"),
1779-
' <table class="table-striped profile-topic-interests"><thead>
1780-
<tr><td></td><th class="ti_interest">Low</th><th class="ti_interest"></th><th class="ti_interest"></th><th class="ti_interest"></th><th class="ti_interest">High</th></tr>
1781-
<tr><td></td><th class="topic-2"></th><th class="topic-1"></th><th class="topic0"></th><th class="topic1"></th><th class="topic2"></th></tr></thead><tbody>', "\n";
1786+
' <table class="profile-topic-interests"><thead><tr>',
1787+
'<th aria-label="Topic"></th>',
1788+
'<th class="ti_interest" aria-label="', $labels[0], '">Low<br><span class="topic-2"></span></th>',
1789+
'<th class="ti_interest" aria-label="', $labels[1], '"><span class="topic-1"></span></th>',
1790+
'<th class="ti_interest" aria-label="', $labels[2], '"><span class="topic0"></span></th>',
1791+
'<th class="ti_interest" aria-label="', $labels[3], '"><span class="topic1"></span></th>',
1792+
'<th class="ti_interest" aria-label="', $labels[4], '">High<br><span class="topic2"></span></th>',
1793+
"</tr></thead>\n";
17821794

1783-
$ibound = [-INF, -1.5, -0.5, 0.5, 1.5, INF];
17841795
$tmap = $us->user->topic_interest_map();
17851796
$ts = $us->conf->topic_set();
1797+
$k = 0;
17861798
foreach ($ts->group_list() as $tg) {
1799+
echo '<tbody>';
17871800
foreach ($tg->members() as $i => $tid) {
17881801
$tic = "ti_topic";
1789-
if ($tg->trivial() || ($i === 0 && $tg->has_group_topic())) {
1802+
$thscope = "row";
1803+
if ($tg->trivial()) {
1804+
$n = $ts->unparse_name_html($tid);
1805+
} else if ($i === 0 && $tg->has_group_topic()) {
17901806
$n = $ts->unparse_name_html($tid);
1807+
$thscope = "rowgroup";
17911808
} else {
1792-
if ($i == 0) {
1793-
echo " <tr><td class=\"ti_topic\">",
1809+
if ($i === 0) {
1810+
echo '<tr class="k', $k, '">',
1811+
'<th class="ti_topic" scope="rowgroup" colspan="6">',
17941812
$tg->unparse_name_html(),
1795-
"</td><td class=\"ti_interest\" colspan=\"5\"></td></tr>\n";
1813+
"</th></tr>\n";
1814+
$k = 1 - $k;
17961815
}
17971816
$n = $ts->unparse_subtopic_name_html($tid);
17981817
$tic .= " ti_subtopic";
17991818
}
1800-
echo " <tr><td class=\"{$tic}\">{$n}</td>";
1819+
echo "<tr class=\"k{$k}\">",
1820+
"<th class=\"{$tic}\" scope=\"{$thscope}\">{$n}</th>";
1821+
$k = 1 - $k;
18011822
$ival = $tmap[$tid] ?? 0;
18021823
$reqval = isset($us->qreq["ti{$tid}"]) ? (int) $us->qreq["ti{$tid}"] : $ival;
18031824
for ($j = -2; $j <= 2; ++$j) {
18041825
$ichecked = $ival >= $ibound[$j+2] && $ival < $ibound[$j+3];
18051826
$reqchecked = $reqval >= $ibound[$j+2] && $reqval < $ibound[$j+3];
1806-
echo '<td class="ti_interest">', Ht::radio("ti{$tid}", $j, $reqchecked, ["class" => "uic js-range-click", "data-range-type" => "topicinterest{$j}", "data-default-checked" => $ichecked]), "</td>";
1827+
echo '<td class="ti_interest">',
1828+
Ht::radio("ti{$tid}", $j, $reqchecked, [
1829+
"class" => "uic js-range-click",
1830+
"data-range-type" => "topicinterest{$j}",
1831+
"data-default-checked" => $ichecked,
1832+
"aria-label" => $labels[$j+2]
1833+
]),
1834+
"</td>";
18071835
}
18081836
echo "</tr>\n";
18091837
}
1838+
echo "</tbody>\n";
18101839
}
1811-
echo " </tbody></table>\n";
1840+
echo "</table>\n";
18121841
}
18131842

18141843
static function print_tags(UserStatus $us) {
18151844
$user = $us->user;
18161845
$tagger = new Tagger($us->viewer);
1817-
$itags = $tagger->unparse($user->viewable_tags($us->viewer));
1818-
if (!$us->viewer->privChair
1819-
&& (!$us->user->isPC || $itags === "")) {
1846+
$itags = $tagger->unparse($us->user->viewable_tags($us->viewer));
1847+
if (!$us->viewer->privChair) {
1848+
if ($us->user->isPC && $itags !== "") {
1849+
$us->print_start_section("Tags");
1850+
echo $itags, "<p class=\"f-d\">Tags represent PC subgroups and are set by administrators.</p>\n";
1851+
}
18201852
return;
18211853
}
1822-
$us->cs()->add_section_class("w-text fx2")->print_start_section("Tags");
1823-
if ($us->viewer->privChair) {
1824-
echo '<div class="', $us->control_class("tags", "f-i"), '">',
1825-
$us->feedback_html_at("tags"),
1826-
Ht::entry("tags", $us->qreq->tags ?? $itags, ["data-default-value" => $itags, "class" => "fullw"]),
1827-
"<p class=\"f-d\">Example: “heavy”. Separate tags by spaces; the “pc” tag is set automatically.<br /><strong>Tip:</strong>&nbsp;Use <a href=\"", $us->conf->hoturl("settings", "group=tags"), "\">tag colors</a> to highlight subgroups in review lists.</p></div>\n";
1828-
} else {
1829-
echo $itags, "<p class=\"f-d\">Tags represent PC subgroups and are set by administrators.</p>\n";
1830-
}
1854+
$us->cs()->add_section_class("w-text fx2")
1855+
->print_start_section("<5>" . Ht::label("Tags", "tags"));
1856+
echo '<div class="', $us->control_class("tags", "f-i"), '">',
1857+
$us->feedback_html_at("tags"),
1858+
Ht::entry("tags", $us->qreq->tags ?? $itags, ["data-default-value" => $itags, "class" => "fullw", "id" => "tags"]),
1859+
"<p class=\"f-d\">Example: “heavy”. Separate tags by spaces; the “pc” tag is set automatically.<br /><strong>Tip:</strong>&nbsp;Use <a href=\"", $us->conf->hoturl("settings", "group=tags"), "\">tag colors</a> to highlight subgroups in review lists.</p></div>\n";
18311860
}
18321861

18331862
private static function print_delete_action(UserStatus $us) {

stylesheets/style.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3046,8 +3046,13 @@ del .rto {
30463046
text-align: center;
30473047
min-width: 2.2rem;
30483048
}
3049+
th.ti_interest {
3050+
vertical-align: bottom;
3051+
}
30493052
.ti_topic {
30503053
padding: 2px 0.5em 2px 6px;
3054+
font-weight: inherit;
3055+
text-align: inherit;
30513056
}
30523057
.ti_subtopic {
30533058
padding-left: 1.75em;
@@ -4437,15 +4442,15 @@ a:hover .t-editor,
44374442
.rfe, .rge {
44384443
margin-bottom: 36px;
44394444
}
4440-
fieldset.pfe, fieldset.rfe {
4445+
fieldset.pfe, fieldset.rfe, fieldset.form-section {
44414446
border: 0 none;
44424447
border-radius: 0;
44434448
padding: 0;
44444449
margin-top: 0;
44454450
margin-left: 0;
44464451
margin-right: 0;
44474452
}
4448-
fieldset.pfe > legend, fieldset.rfe > legend {
4453+
fieldset.pfe > legend, fieldset.rfe > legend, fieldset.form-section > legend {
44494454
padding: 0;
44504455
}
44514456
.revvt {

0 commit comments

Comments
 (0)