Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
## 2024-07-13 - CLI Debugging Stack Traces
**Learning:** Adding a `FAST_MLSIRM_DEBUG` bypass to user-friendly `try/except` blocks is crucial for DX. Otherwise, unexpected runtime errors during development will be swallowed into generic stderr messages, hiding the stack trace needed to actually fix the bug.
**Action:** When adding `try-except` blocks to Python CLI subcommands to improve Developer Experience (DX) by preventing raw tracebacks for users, include a debug bypass (e.g., `if os.environ.get("FAST_MLSIRM_DEBUG"): raise`) in *all* catch blocks (including `RuntimeError` and `Exception`) to ensure tracebacks aren't swallowed during local development and debugging.

## 2024-07-14 - Skip-Link Target Keyboard Focus Accessibility
**Learning:** Setting `outline: none;` on a skip-link target like `<main tabindex="-1">` correctly hides the focus ring when activated via mouse click. However, it also completely removes the visible focus indicator when the skip-link is activated via keyboard navigation, leaving keyboard users without visual context of their position.
**Action:** Always complement `outline: none;` (or `:focus { outline: none; }`) with `:focus-visible { outline: 3px solid [color]; outline-offset: 3px; }` for skip-link targets and similarly keyboard-navigable containers to ensure accessibility.
4 changes: 2 additions & 2 deletions crates/fast-mlsirm-py/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions python/fast_mlsirm/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ def _css() -> str:
outline: none;
}

main:focus-visible {
outline: 3px solid #0f766e;
outline-offset: 3px;
}

.hero {
min-height: 172px;
display: flex;
Expand Down
31 changes: 26 additions & 5 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ def test_render_fit_diagnostics_report_has_sections(tmp_path):
source.write_text(
json.dumps(
{
"itemfit": {"item_id": [0, 1], "outfit_mnsq": [1.0, 1.2], "observed_count": [4, 4]},
"personfit": {"person_id": [0, 1], "outfit_mnsq": [0.9, 1.1], "observed_count": [2, 2]},
"itemfit": {
"item_id": [0, 1],
"outfit_mnsq": [1.0, 1.2],
"observed_count": [4, 4],
},
"personfit": {
"person_id": [0, 1],
"outfit_mnsq": [0.9, 1.1],
"observed_count": [2, 2],
},
"factorfit": {},
"categoryfit": {},
"groupfit": {},
Expand Down Expand Up @@ -102,7 +110,11 @@ def test_render_report_summarizes_empty_metric_sections(tmp_path):
json.dumps(
{
"model_fit": {},
"itemfit": {"item_id": [0], "outfit_mnsq": [1.0], "observed_count": [4]},
"itemfit": {
"item_id": [0],
"outfit_mnsq": [1.0],
"observed_count": [4],
},
}
),
encoding="utf-8",
Expand Down Expand Up @@ -178,7 +190,11 @@ def test_render_table_section_omits_empty_chart_placeholder(tmp_path):
json.dumps(
{
"model_fit": {"loglik": -3.2},
"itemfit": {"item_id": ["A"], "outfit_mnsq": [None], "observed_count": [4]},
"itemfit": {
"item_id": ["A"],
"outfit_mnsq": [None],
"observed_count": [4],
},
}
),
encoding="utf-8",
Expand All @@ -201,7 +217,11 @@ def test_render_table_section_charts_later_numeric_rows(tmp_path):
json.dumps(
{
"model_fit": {"loglik": -3.2},
"itemfit": {"item_id": item_ids, "outfit_mnsq": outfit, "observed_count": [4] * 13},
"itemfit": {
"item_id": item_ids,
"outfit_mnsq": outfit,
"observed_count": [4] * 13,
},
}
),
encoding="utf-8",
Expand Down Expand Up @@ -253,6 +273,7 @@ def test_render_table_region_has_keyboard_focus_style(tmp_path):
assert 'tabindex="0"' in html
assert ".table-wrap:focus-visible" in html
assert ".table-wrap:focus {" not in html
assert "main:focus-visible {" in html
assert "tbody tr:hover" in html
assert '<div class="bar-chart" aria-hidden="true">' in html
assert '<div class="bar-track" aria-hidden="true">' in html
Loading