Single focus ring on buttons and fields, tidier branch protection form, token delete row stays aligned
Browse files at this commit796cc37d6dfc9b74f0e27c41b9efe94422fd9ad0Parent: af25eab- style
- single focus ring on buttons and fields, tidier branch protection form, token delete row stays aligned
2 changed files +161 -54
- crates/forge-web/src/pages/repo_settings.rs +58 -50
- style/main.scss +103 -4
crates/forge-web/src/pages/repo_settings.rsmodified+58 -50
| @@ -495,7 +495,7 @@ async fn branch_rules_table( | |||
| 495 | <th>(g::t(lang, K::ForcePushAllowed))</th> | 495 | <th>(g::t(lang, K::ForcePushAllowed))</th> |
| 496 | <th>(g::t(lang, K::DeletionAllowed))</th> | 496 | <th>(g::t(lang, K::DeletionAllowed))</th> |
| 497 | <th>(g::t(lang, K::MergePushRules))</th> | 497 | <th>(g::t(lang, K::MergePushRules))</th> |
| 498 | - <th><span class="muted small">(g::t(lang, K::Remove))</span></th> | 498 | + <th><span class="sr-only">(g::t(lang, K::Remove))</span></th> |
| 499 | </tr> | 499 | </tr> |
| 500 | </thead> | 500 | </thead> |
| 501 | <tbody> | 501 | <tbody> |
| @@ -549,55 +549,63 @@ async fn branch_rule_form( | |||
| 549 | alert(message: message.as_str()) | 549 | alert(message: message.as_str()) |
| 550 | } | 550 | } |
| 551 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 551 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 552 | - <label> | 552 | + <div class="rule-group"> |
| 553 | - <span>(g::t(lang, K::BranchPattern))</span> | 553 | + <label> |
| 554 | - <input type="text" name="pattern" value=(pattern.as_str()) autocomplete="off" spellcheck="false" required=(true)> | 554 | + <span>(g::t(lang, K::BranchPattern))</span> |
| 555 | - </label> | 555 | + <input type="text" name="pattern" value=(pattern.as_str()) autocomplete="off" spellcheck="false" required=(true)> |
| 556 | - <p class="muted small">(g::t(lang, K::PatternHelpA))<code>"*"</code>(g::t(lang, K::PatternHelpB))<code>"**"</code>(g::t(lang, K::PatternHelpC))<code>"/"</code>(g::t(lang, K::PatternHelpD))</p> | 556 | + </label> |
| 557 | - <label class="inline"> | 557 | + <p class="muted small">(g::t(lang, K::PatternHelpA))<code>"*"</code>(g::t(lang, K::PatternHelpB))<code>"**"</code>(g::t(lang, K::PatternHelpC))<code>"/"</code>(g::t(lang, K::PatternHelpD))</p> |
| 558 | - <input type="checkbox" name="allow_force_push" value="on" checked=(allow_force_push)> | 558 | + </div> |
| 559 | - <span>(g::t(lang, K::AllowForcePush))</span> | 559 | + <div class="rule-group"> |
| 560 | - </label> | 560 | + <label class="inline"> |
| 561 | - <label class="inline"> | 561 | + <input type="checkbox" name="allow_force_push" value="on" checked=(allow_force_push)> |
| 562 | - <input type="checkbox" name="allow_deletion" value="on" checked=(allow_deletion)> | 562 | + <span>(g::t(lang, K::AllowForcePush))</span> |
| 563 | - <span>(g::t(lang, K::AllowDeletion))</span> | 563 | + </label> |
| 564 | - </label> | 564 | + <label class="inline"> |
| 565 | - <label> | 565 | + <input type="checkbox" name="allow_deletion" value="on" checked=(allow_deletion)> |
| 566 | - <span>(g::t(lang, K::RequiredApprovals))</span> | 566 | + <span>(g::t(lang, K::AllowDeletion))</span> |
| 567 | - <input type="number" name="required_approvals" min="0" max="20" step="1" inputmode="numeric" value=(required_approvals.as_str())> | 567 | + </label> |
| 568 | - </label> | 568 | + </div> |
| 569 | - <p class="muted small">(g::t(lang, K::ApprovalsHelp))</p> | 569 | + <div class="rule-group"> |
| 570 | - <label class="inline"> | 570 | + <label> |
| 571 | - <input type="checkbox" name="block_on_changes_requested" value="on" checked=(block_on_changes_requested)> | 571 | + <span>(g::t(lang, K::RequiredApprovals))</span> |
| 572 | - <span>(g::t(lang, K::BlockWhileChanges))</span> | 572 | + <input type="number" name="required_approvals" min="0" max="20" step="1" inputmode="numeric" value=(required_approvals.as_str())> |
| 573 | - </label> | 573 | + </label> |
| 574 | - <label class="inline"> | 574 | + <p class="muted small">(g::t(lang, K::ApprovalsHelp))</p> |
| 575 | - <input type="checkbox" name="require_up_to_date" value="on" checked=(require_up_to_date)> | 575 | + <label class="inline"> |
| 576 | - <span>(g::t(lang, K::RequireUpToDate))</span> | 576 | + <input type="checkbox" name="block_on_changes_requested" value="on" checked=(block_on_changes_requested)> |
| 577 | - </label> | 577 | + <span>(g::t(lang, K::BlockWhileChanges))</span> |
| 578 | - <label class="inline"> | 578 | + </label> |
| 579 | - <input type="checkbox" name="restrict_push" value="on" checked=(restrict_push)> | 579 | + <label class="inline"> |
| 580 | - <span>(g::t(lang, K::RestrictPush))</span> | 580 | + <input type="checkbox" name="require_up_to_date" value="on" checked=(require_up_to_date)> |
| 581 | - </label> | 581 | + <span>(g::t(lang, K::RequireUpToDate))</span> |
| 582 | - <label class="inline"> | 582 | + </label> |
| 583 | - <input type="checkbox" name="require_merge_queue" value="on" checked=(require_merge_queue)> | 583 | + <label class="inline"> |
| 584 | - <span>(mq::t(lang, mq::K::RequireMergeQueue))</span> | 584 | + <input type="checkbox" name="restrict_push" value="on" checked=(restrict_push)> |
| 585 | - </label> | 585 | + <span>(g::t(lang, K::RestrictPush))</span> |
| 586 | - <p class="muted small">(mq::t(lang, mq::K::RequireMergeQueueHint))</p> | 586 | + </label> |
| 587 | - <label> | 587 | + <label class="inline"> |
| 588 | - <span>(g::t(lang, K::RequiredChecks))</span> | 588 | + <input type="checkbox" name="require_merge_queue" value="on" checked=(require_merge_queue)> |
| 589 | - <input type="text" name="required_checks" value=(required_checks.as_str()) autocomplete="off" spellcheck="false" placeholder="ci/test, ci/lint"> | 589 | + <span>(mq::t(lang, mq::K::RequireMergeQueue))</span> |
| 590 | - </label> | 590 | + </label> |
| 591 | - <p class="muted small">(g::t(lang, K::RequiredChecksHelp))</p> | 591 | + <p class="muted small check-help">(mq::t(lang, mq::K::RequireMergeQueueHint))</p> |
| 592 | - if !contexts.is_empty() { | 592 | + </div> |
| 593 | - <div class="context-picker"> | 593 | + <div class="rule-group"> |
| 594 | - <span class="muted small">(g::t(lang, K::RecentContexts))</span> | 594 | + <label> |
| 595 | - for context in contexts.iter() { | 595 | + <span>(g::t(lang, K::RequiredChecks))</span> |
| 596 | - <button type="button" class="context-chip" data-check-add=(context.as_str())>(context.as_str())</button> | 596 | + <input type="text" name="required_checks" value=(required_checks.as_str()) autocomplete="off" spellcheck="false" placeholder="ci/test, ci/lint"> |
| 597 | - } | 597 | + </label> |
| 598 | - </div> | 598 | + <p class="muted small">(g::t(lang, K::RequiredChecksHelp))</p> |
| 599 | - } | 599 | + if !contexts.is_empty() { |
| 600 | - <div> | 600 | + <div class="context-picker"> |
| 601 | + <span class="muted small">(g::t(lang, K::RecentContexts))</span> | ||
| 602 | + for context in contexts.iter() { | ||
| 603 | + <button type="button" class="context-chip" data-check-add=(context.as_str())>(context.as_str())</button> | ||
| 604 | + } | ||
| 605 | + </div> | ||
| 606 | + } | ||
| 607 | + </div> | ||
| 608 | + <div class="form-actions"> | ||
| 601 | <button type="submit">(g::t(lang, K::SaveRule))</button> | 609 | <button type="submit">(g::t(lang, K::SaveRule))</button> |
| 602 | </div> | 610 | </div> |
| 603 | </form> | 611 | </form> |
style/main.scssmodified+103 -4
| @@ -395,6 +395,15 @@ button { | |||
| 395 | cursor: not-allowed; | 395 | cursor: not-allowed; |
| 396 | } | 396 | } |
| 397 | 397 | ||
| 398 | + // Keyboard focus uses the same ring as text inputs (border + soft halo) instead of the | ||
| 399 | + // global 2px outline, which sat apart from the border and squared off the corners. | ||
| 400 | + &:focus-visible { | ||
| 401 | + outline: none; | ||
| 402 | + border-color: var(--focus); | ||
| 403 | + border-radius: var(--radius-md); | ||
| 404 | + box-shadow: 0 0 0 3px var(--accent-soft); | ||
| 405 | + } | ||
| 406 | + | ||
| 398 | &.primary { | 407 | &.primary { |
| 399 | background: var(--accent); | 408 | background: var(--accent); |
| 400 | border-color: var(--accent); | 409 | border-color: var(--accent); |
| @@ -414,6 +423,11 @@ button { | |||
| 414 | &:hover { | 423 | &:hover { |
| 415 | background: var(--danger-bg); | 424 | background: var(--danger-bg); |
| 416 | } | 425 | } |
| 426 | + | ||
| 427 | + &:focus-visible { | ||
| 428 | + border-color: var(--danger); | ||
| 429 | + box-shadow: 0 0 0 3px var(--danger-bg); | ||
| 430 | + } | ||
| 417 | } | 431 | } |
| 418 | } | 432 | } |
| 419 | 433 | ||
| @@ -440,6 +454,13 @@ button.link-button { | |||
| 440 | background: none; | 454 | background: none; |
| 441 | text-decoration: underline; | 455 | text-decoration: underline; |
| 442 | } | 456 | } |
| 457 | + | ||
| 458 | + // Borderless, so it keeps the outline ring rather than the bordered button halo. | ||
| 459 | + &:focus-visible { | ||
| 460 | + outline: 2px solid var(--focus); | ||
| 461 | + outline-offset: 2px; | ||
| 462 | + box-shadow: none; | ||
| 463 | + } | ||
| 443 | } | 464 | } |
| 444 | 465 | ||
| 445 | // Forms | 466 | // Forms |
| @@ -809,6 +830,20 @@ code { | |||
| 809 | align-self: flex-start; | 830 | align-self: flex-start; |
| 810 | } | 831 | } |
| 811 | } | 832 | } |
| 833 | + | ||
| 834 | + // A confirm opened on a row grows the row tall: keep the name and the Delete button on the top | ||
| 835 | + // edge, and right-align the summary and its popover under the row's end. | ||
| 836 | + &:has(> .confirm-inline[open]) { | ||
| 837 | + align-items: flex-start; | ||
| 838 | + } | ||
| 839 | + | ||
| 840 | + > .confirm-inline { | ||
| 841 | + text-align: right; | ||
| 842 | + | ||
| 843 | + .confirm-pop { | ||
| 844 | + margin-left: auto; | ||
| 845 | + } | ||
| 846 | + } | ||
| 812 | } | 847 | } |
| 813 | 848 | ||
| 814 | .branch-list li { | 849 | .branch-list li { |
| @@ -1135,9 +1170,11 @@ code { | |||
| 1135 | border: 1px solid var(--border); | 1170 | border: 1px solid var(--border); |
| 1136 | border-radius: var(--radius-md); | 1171 | border-radius: var(--radius-md); |
| 1137 | 1172 | ||
| 1173 | + &:focus, | ||
| 1138 | &:focus-visible { | 1174 | &:focus-visible { |
| 1139 | - outline: 2px solid var(--focus); | 1175 | + outline: none; |
| 1140 | - outline-offset: 1px; | 1176 | + border-color: var(--focus); |
| 1177 | + box-shadow: 0 0 0 3px var(--accent-soft); | ||
| 1141 | } | 1178 | } |
| 1142 | } | 1179 | } |
| 1143 | 1180 | ||
| @@ -1167,6 +1204,7 @@ code { | |||
| 1167 | &:focus-visible { | 1204 | &:focus-visible { |
| 1168 | outline: 2px solid var(--focus); | 1205 | outline: 2px solid var(--focus); |
| 1169 | outline-offset: 1px; | 1206 | outline-offset: 1px; |
| 1207 | + box-shadow: none; | ||
| 1170 | } | 1208 | } |
| 1171 | } | 1209 | } |
| 1172 | } | 1210 | } |
| @@ -2538,8 +2576,26 @@ code { | |||
| 2538 | // branch protection | 2576 | // branch protection |
| 2539 | // Settings page: rules table with a Remove form per row, then the add/update form. | 2577 | // Settings page: rules table with a Remove form per row, then the add/update form. |
| 2540 | .branch-rules { | 2578 | .branch-rules { |
| 2579 | + // Data columns size to their content; the rule summary takes the slack and the action sits at the end. | ||
| 2580 | + th:nth-child(4), | ||
| 2581 | + td:nth-child(4) { | ||
| 2582 | + width: 100%; | ||
| 2583 | + } | ||
| 2584 | + | ||
| 2585 | + th:last-child, | ||
| 2586 | + td:last-child { | ||
| 2587 | + text-align: right; | ||
| 2588 | + white-space: nowrap; | ||
| 2589 | + } | ||
| 2590 | + | ||
| 2541 | .remove-form { | 2591 | .remove-form { |
| 2542 | margin: 0; | 2592 | margin: 0; |
| 2593 | + display: flex; | ||
| 2594 | + justify-content: flex-end; | ||
| 2595 | + | ||
| 2596 | + button { | ||
| 2597 | + width: auto; | ||
| 2598 | + } | ||
| 2543 | } | 2599 | } |
| 2544 | 2600 | ||
| 2545 | tr.muted td { | 2601 | tr.muted td { |
| @@ -2547,11 +2603,36 @@ code { | |||
| 2547 | } | 2603 | } |
| 2548 | } | 2604 | } |
| 2549 | 2605 | ||
| 2606 | +// Rule form: fields share one width, the approvals count is narrow, and each group of related | ||
| 2607 | +// fields sits apart from the next. Help text stays under its field. | ||
| 2550 | .branch-form { | 2608 | .branch-form { |
| 2551 | max-width: 40rem; | 2609 | max-width: 40rem; |
| 2610 | + gap: 24px; | ||
| 2552 | 2611 | ||
| 2553 | input[type="text"] { | 2612 | input[type="text"] { |
| 2554 | - max-width: 24rem; | 2613 | + max-width: 28rem; |
| 2614 | + } | ||
| 2615 | + | ||
| 2616 | + input[type="number"] { | ||
| 2617 | + width: 8rem; | ||
| 2618 | + max-width: 8rem; | ||
| 2619 | + } | ||
| 2620 | + | ||
| 2621 | + .rule-group { | ||
| 2622 | + display: flex; | ||
| 2623 | + flex-direction: column; | ||
| 2624 | + gap: 8px; | ||
| 2625 | + | ||
| 2626 | + > p.muted.small { | ||
| 2627 | + max-width: 28rem; | ||
| 2628 | + margin: -4px 0 0; | ||
| 2629 | + } | ||
| 2630 | + | ||
| 2631 | + // Help for a checkbox lines up with its label text, past the box. | ||
| 2632 | + > p.check-help { | ||
| 2633 | + margin-left: 24px; | ||
| 2634 | + max-width: 28rem; | ||
| 2635 | + } | ||
| 2555 | } | 2636 | } |
| 2556 | } | 2637 | } |
| 2557 | 2638 | ||
| @@ -4118,6 +4199,13 @@ span.reaction { | |||
| 4118 | border-radius: 0; | 4199 | border-radius: 0; |
| 4119 | cursor: pointer; | 4200 | cursor: pointer; |
| 4120 | 4201 | ||
| 4202 | + &:focus-visible { | ||
| 4203 | + outline: 2px solid var(--focus); | ||
| 4204 | + outline-offset: -2px; | ||
| 4205 | + border-radius: 0; | ||
| 4206 | + box-shadow: none; | ||
| 4207 | + } | ||
| 4208 | + | ||
| 4121 | &:hover { | 4209 | &:hover { |
| 4122 | background: var(--surface-2); | 4210 | background: var(--surface-2); |
| 4123 | } | 4211 | } |
| @@ -4767,9 +4855,14 @@ $ansi-colours: ( | |||
| 4767 | text-align: left; | 4855 | text-align: left; |
| 4768 | font-weight: 400; | 4856 | font-weight: 400; |
| 4769 | 4857 | ||
| 4770 | - &:hover:not(:disabled), | 4858 | + &:hover:not(:disabled) { |
| 4859 | + background: var(--code-bg); | ||
| 4860 | + } | ||
| 4861 | + | ||
| 4771 | &:focus-visible { | 4862 | &:focus-visible { |
| 4772 | background: var(--code-bg); | 4863 | background: var(--code-bg); |
| 4864 | + outline: 2px solid var(--focus); | ||
| 4865 | + outline-offset: -2px; | ||
| 4773 | } | 4866 | } |
| 4774 | 4867 | ||
| 4775 | &.danger { | 4868 | &.danger { |
| @@ -5598,6 +5691,12 @@ form.runner-conc-form { | |||
| 5598 | button.ci-job-last { | 5691 | button.ci-job-last { |
| 5599 | cursor: pointer; | 5692 | cursor: pointer; |
| 5600 | 5693 | ||
| 5694 | + &:focus-visible { | ||
| 5695 | + outline: 2px solid var(--focus); | ||
| 5696 | + outline-offset: -2px; | ||
| 5697 | + box-shadow: none; | ||
| 5698 | + } | ||
| 5699 | + | ||
| 5601 | &:hover { | 5700 | &:hover { |
| 5602 | color: var(--text-2); | 5701 | color: var(--text-2); |
| 5603 | } | 5702 | } |