UNPKG

axe-playwright-report

Version:

Playwright + axe-core integration to run accessibility scans and build HTML dashboard reports.

1,436 lines (1,165 loc) 25 kB
:root { --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; --color-critical: #b91c1c; /* Soft red */ --color-serious: #b25000; /* Vivid orange */ --color-moderate: #b28900; /* Bright yellow */ --color-minor: #2e7d32; /* Light green */ --color-success: #14613a; --color-neutral: #5a6268; --color-border: #dee2e6; --color-background: #f8f9fa; --color-text: #212529; --primary: #244eea; --primary-light: #eef1ff; --danger: #e53935; --warning: #ff9800; --success: #2e7d32; --info: #66757c; --gray: #f5f5f5; --dark-gray: #515151; --text: #333; --border: #ddd; --blind-color: #1f77b4; --deafblind-color: #ff7f0e; --mobility-color: #2ca02c; --low-vision-color: #d62728; --cognitive-color: #9467bd; --colorblindness-color: #8c564b; --deaf-color: #e377c2; --attention-deficit-color: #7f7f7f; --sighted-keyboard-users-color: #bcbd22; --dyslexia-color: #17becf; --color-background: #f8f9fa; } #bugReportModal { z-index: 10000 !important; } .select2-container { z-index: 2000 !important; } .select2-container--open { z-index: 1051 !important; } th { font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-neutral); cursor: pointer; } .visually-hidden { position: absolute; left: -9999px; } .disabilities-circle { width: 200px; height: 200px; border-radius: 50%; position: relative; background: conic-gradient(var(--danger) 0% 45%, var(--warning) 45% 70%, var(--success) 70% 90%, var(--info) 90% 100%); } .disabilities-circle::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70%; height: 70%; border-radius: 50%; background-color: white; } .legend-visual { background-color: var(--danger); } .legend-cognitive { background-color: var(--warning); } .legend-motor { background-color: var(--success); } .legend-hearing { background-color: var(--info); } .status-cell.critical_elements { color: var(--color-critical); } .status-cell.serious_elements { color: var(--color-serious); } .status-cell.moderate_elements { color: var(--color-moderate); } .status-cell.minor_elements { color: var(--color-minor); } .violation-badge.violations { background-color: rgba(220, 53, 69, 0.1); color: var(--color-critical); } .violation-badge.incomplete { background-color: rgba(255, 193, 7, 0.1); color: #c28100; } .violation-badge.passes { background-color: rgba(25, 135, 84, 0.1); color: var(--color-success); } .violation-badge { display: inline-flex; align-items: center; padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-size: 0.9rem; font-weight: 600; } body { font-family: var(--font-family); margin: 0; padding: 0; color: var(--text); background-color: #f8f9fa; transition: all 0.3s ease; } .container {} header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px 5px; border-bottom: 5px solid var(--border); } .logo { font-size: 20px; font-weight: 700; color: var(--primary); } .header-actions { display: flex; align-items: center; gap: 20px; } .filters { display: flex; align-items: center; } #filter-priority { padding: 0.5rem; border: 1px solid var(--color-border); border-radius: 0.25rem; background-color: white; min-width: 150px; } nav { display: flex; padding: 10px 0px; } .search-and-filters { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; } .breadcrumb { display: flex; list-style: none; margin: 0; padding: 0; } .breadcrumb li { display: flex; align-items: center; } .breadcrumb li:not(:last-child)::after { content: "/"; margin: 0 10px; color: var(--text); opacity: 0.5; } .breadcrumb a { color: var(--color-neutral); text-decoration: none; } .back-button { margin-right: 10px; background: none; border: none; color: var(--primary); cursor: pointer; display: flex; align-items: center; font-size: 14px; } .back-button::before { content: "←"; margin-right: 5px; } .dashboard, .report-page { display: none; } .active { display: block; } .dashboard-header, .report-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } h1 { font-size: 24px; margin: 0; } .header-actions button { background-color: var(--primary); color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; margin-left: 10px; } .summary-cards { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; } .card { background-color: white; border-radius: 8px; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); flex: 1; min-width: 150px; } .card-header { border-bottom: 1px solid #555; /* line ander Total Reports*/ display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; } .card-title { font-size: 16px; font-weight: 600; margin: 0; } .card-value { font-size: 32px; font-weight: 700; margin: 0; } .violations { color: var(--danger); } .incomplete { color: var(--warning); } .passes { color: var(--success); } .inapplicable { color: var(--info); } .tooltip { position: relative; display: inline-block; cursor: pointer; } .inapplicable-tooltip-wrapper { position: relative; display: inline-block; } .tooltip-text { visibility: hidden; background: #f7f7f7 !important; color: #080000 !important; text-align: center; border-radius: 4px; position: absolute; z-index: 99999; top: 100%; /* under the icon */ left: 50%; transform: translateX(-50%); white-space: normal; min-width: 280px; max-width: 320px; font-size: 14px; font-weight: normal; opacity: 0; transition: opacity 0.2s; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28) !important; border: 2px solid #e0e0e0 !important; pointer-events: none; word-break: break-word; } .inapplicable-tooltip-wrapper:hover .tooltip-text, .inapplicable-tooltip-wrapper:focus-within .tooltip-text { visibility: visible; opacity: 1; pointer-events: auto; } .filter-bar { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; padding: 15px; background-color: var(--gray); border-radius: 8px; } .filter-group { display: flex; flex-direction: column; min-width: 150px; } .filter-label { font-size: 14px; margin-bottom: 5px; font-weight: 500; } .filter-select, .filter-input { padding: 8px; border: 1px solid var(--border); border-radius: 4px; background-color: white; } .search-container { flex-grow: 1; } .search-input { width: 100%; padding: 8px 15px; border: 1px solid var(--border); border-radius: 4px; background-color: white; } .chart-container { display: flex; flex-direction: column; gap: 2rem; /* spacing between chart and bars */ margin-bottom: 20px; } .chart-content { display: flex; justify-content: center; align-items: center; padding: 1rem 0; } .chart-content canvas { max-width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; } .chart { flex: 1; margin-top: 0; /* Remove any top margin from the parent container */ min-width: 300px; min-height: 200px; height: auto; /* Adjust height dynamically */ overflow-y: auto; background-color: white; border-radius: 10px; padding: 20px; box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; } .horizontal-bar-chart::-webkit-scrollbar { width: 6px; } .horizontal-bar-chart::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; } .horizontal-bar-chart::-webkit-scrollbar-thumb { background: #666; border-radius: 3px; } .horizontal-bar-chart::-webkit-scrollbar-thumb:hover { background: #555; } .horizontal-bar-chart { display: flex; flex-direction: column; gap: 0.5rem; } .chart-title { font-size: 16px; font-weight: 600; margin-bottom: 15px; } /*.impact-circle {*/ /* width: 200px;*/ /* height: 200px;*/ /* border-radius: 50%;*/ /* position: relative;*/ /* background: conic-gradient(var(--danger) 0% 40%, var(--warning) 40% 65%, var(--info) 65% 85%, #999 85% 100%);*/ /*}*/ #pagination-controls { display: flex; justify-content: center; align-items: center; margin-top: 10px; margin-bottom: 20px; gap: 10px; } /* Style for pagination buttons */ #pagination-controls button { padding: 8px 12px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; background-color: #f9f9f9; cursor: pointer; transition: background-color 0.3s, color 0.3s; } .nodes-list { display: flex; flex-direction: column; gap: 15px; } .node-item { border: 1px solid var(--border); border-radius: 6px; padding: 15px 15px 15px 15px; margin-bottom: 10px; position: relative; } .node-html { background-color: #f3f4f6; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 14px; margin-bottom: 10px; overflow-x: auto; } .failure-list { list-style-type: disc; padding-left: 20px; } .failure-list li { margin-bottom: 4px; } .failure-summary { background-color: #fef2f2; border-left: 4px solid var(--danger); padding: 10px 15px; margin-top: 10px; } .failure-summary h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; } .toggle-details { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 4px; } .toggle-details i { transition: transform 0.2s; } .toggle-details.expanded i { transform: rotate(180deg); } /* Hover effect for buttons */ #pagination-controls button:hover { background-color: #007bff; color: #fff; } /* Active button style */ #pagination-controls button:disabled { background-color: #007bff; color: #fff; cursor: not-allowed; border-color: #007bff; } /*.impact-circle::after {*/ /* content: "";*/ /* position: absolute;*/ /* top: 50%;*/ /* left: 50%;*/ /* transform: translate(-50%, -50%);*/ /* width: 70%;*/ /* height: 70%;*/ /* border-radius: 50%;*/ /* background-color: white;*/ /*}*/ .impact-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-top: 15px; } .legend-item { display: flex; align-items: center; font-size: 14px; } .legend-color { width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; } /* Accessibility categories with unique colors */ .legend-critical { background-color: var(--danger); } .legend-serious { background-color: var(--warning); } .legend-moderate { background-color: var(--info); } .legend-none { background-color: #999; } thead { background-color: var(--color-background); border-bottom: 2px solid var(--color-border); } #sortable-table { background: white; border-radius: 0.5rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); overflow: hidden; width: 100%; border-collapse: collapse; } #sortable-table tbody tr { border-bottom: 1px solid #ccc; /* light grey */ } tr:last-child { border-bottom: none; } th, td { padding: 1rem; text-align: left; } tr:hover { background-color: var(--gray); } tr { border-bottom: 1px solid var(--color-border); } .url-cell { font-weight: 500; } .url-cell a { text-decoration: none; } .status-cell { font-weight: 600; } .pagination { display: flex; justify-content: center; gap: 5px; margin-top: 20px; } .pagination button { background-color: white; border: 1px solid var(--border); padding: 8px 12px; border-radius: 4px; cursor: pointer; } .pagination button.active { background-color: var(--primary); color: white; border-color: var(--primary); } /* Report Page Styles */ .report-layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; } .report-sidebar { background-color: var(--gray); border-radius: 8px; padding: 15px; height: fit-content; } .sidebar-section { margin-bottom: 20px; } .sidebar-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; padding-bottom: 5px; border-bottom: 1px solid var(--border); } .sidebar-menu { list-style: none; padding: 0; margin: 0; } .sidebar-menu li { margin-bottom: 8px; } .sidebar-menu a { color: var(--text); text-decoration: none; padding: 8px 10px; display: block; border-radius: 4px; } .sidebar-menu a:hover, .sidebar-menu a.active { background-color: var(--primary-light); color: var(--primary); } .sidebar-menu .count { float: right; background-color: var(--primary); color: white; border-radius: 10px; padding: 2px 8px; font-size: 12px; } .tab-container { margin-top: 20px; } .tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; } .tab { padding: 10px 20px; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 500; } /* Make strategy buttons with data-tab attribute take full width of parent grid */ button[data-tab] { width: 100%; } /* Ensure the grid containing data-tab buttons uses the full width */ div.mb-6>.grid-cols-4 { grid-template-columns: repeat(3, 1fr) !important; } .tab.active { border-bottom-color: var(--primary); color: var(--primary); } .tab-content { display: none; } .tab-content.active { display: block; } .issue-card { background-color: white; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); overflow: hidden; } .issue-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background-color: var(--primary-light); } .issue-title { font-size: 16px; font-weight: 600; margin: 0; display: flex; align-items: center; } .issue-type { padding: 3px 10px; border-radius: 12px; font-size: 12px; margin-left: 10px; color: white; } .issue-type.critical { background-color: var(--danger); } .issue-type.serious { background-color: var(--warning); } .issue-type.moderate { background-color: var(--info); } .issue-id { font-family: monospace; font-size: 14px; color: var(--primary); } .issue-content { padding: 20px; } .issue-section { margin-bottom: 15px; } .issue-section-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; color: var(--dark-gray); } .screenshot { margin-top: 20px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; } .screenshot img { max-width: 100%; display: block; } .code-block { background-color: var(--gray); padding: 15px; border-radius: 4px; margin: 10px 0; font-family: monospace; overflow-x: auto; } .suggested-fix { background-color: rgba(67, 160, 71, 0.1); border-left: 4px solid var(--success); padding: 15px; margin-top: 15px; } .collapsible { cursor: pointer; } .collapsible::after { content: " ▼"; font-size: 12px; color: var(--primary); } .collapsed::after { content: " ►"; } .collapsible-content { max-height: 1000px; overflow: hidden; transition: max-height 0.3s ease; } .collapsed+.collapsible-content { max-height: 0; } .help-section { background-color: #2563eb; color: white; padding: 1rem; border-radius: 0.5rem; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .node-details { margin-top: 10px; } .node-details.hidden { display: none; } @media (max-width: 768px) { .report-layout { grid-template-columns: 1fr; } .summary-cards { flex-direction: column; } } @media (max-width: 576px) { .summary-cards { flex-direction: column; } .header-actions { flex-direction: column; align-items: flex-end; } } @media (max-width: 576px) { .summary-cards { flex-direction: column; } .header-actions { flex-direction: column; align-items: flex-end; } } #dashboard-search-input { flex: 1; padding: 0.5rem; padding-right: 2.5rem; border: 1px solid var(--color-border); border-radius: 0.25rem; background-color: white; } /* Style 3 - Stats With Icons */ .icon-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin: 0 auto 20px auto; } .icon-card { background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 12px; display: flex; align-items: center; /* Vertical center */ justify-content: center; /* Horizontal center */ flex-direction: row; flex-wrap: nowrap; gap: 16px; /* Optional spacing between icon and text */ } .icon-card:hover { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15); } .card-icon { width: 65px; height: 65px; margin-left: 15px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; } .icon-total { background-color: #e8f4fd; color: #3498db; } .icon-violations { background-color: #fdeeee; color: #e74c3c; } .icon-incomplete { background-color: #fef5e8; color: #f39c12; } .icon-passes { background-color: #e8f6ef; color: #219653; } .icon-content { flex-grow: 1; margin-left: 20px; } .icon-title { margin: 0 0 5px 0; color: #666; font-size: 18px; font-weight: 600; } .icon-value { font-size: 16px; font-weight: bold; margin: 0; color: #333; } .rule-value { font-size: 14px; margin: 0; color: #333; } /* Select2 Custom Styles */ .select2-container--default .select2-selection--multiple { border: 1px solid #d1d5db; border-radius: 0.375rem; min-height: 38px; padding: 4px 8px; } .select2-container--default .select2-selection--multiple .select2-selection__choice { background-color: #3b82f6; color: white; border: none; border-radius: 0.25rem; margin: 2px 4px 2px 0; font-size: 0.875rem; } .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { display: inline-flex; justify-content: center; color: white; font-weight: bold; font-size: 14px; margin-right: 5px; height: 100%; cursor: pointer; background: transparent; border: none; } .select2-container--default .select2-selection--multiple .select2-selection__clear { margin-top: 0px; } .select2-container--default .select2-selection--multiple .select2-selection__choice__display { padding-left: 5px; font-size: 1rem; } .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { color: #fbbf24; } .select2-container--default .select2-selection--multiple .select2-selection__rendered { padding: 0; } .select2-container--default .select2-search--inline .select2-search__field { margin-top: 0; margin-left: 0; } .select2-container .select2-search--inline .select2-search__field { height: 21px } .select2-container--default .select2-selection--multiple .select2-selection__placeholder { color: #6b7280; font-size: 0.875rem; } .select2-dropdown { border: 1px solid #d1d5db; border-radius: 0.375rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); } .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #3b82f6; color: white; } .select2-container--default .select2-selection--multiple:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); } /* Ensure Select2 dropdowns don't interfere with other elements */ .select2-container { z-index: 1050; } .center-cell { text-align: center; } .border-col { border-right: 0px solid var(--color-border); } /* Enhanced Search and Filter Styles */ .search-and-filters { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; } .search-box { display: flex; flex: 1; max-width: 400px; position: relative; } .search-input { flex: 1; padding: 0.5rem; padding-right: 2.5rem; border: 1px solid var(--color-border); border-radius: 0.25rem; background-color: white; font-size: 0.875rem; } .search-input:focus { outline: none; border-color: var(--color-moderate); box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25); } .search-button { position: absolute; right: 0; top: 0; bottom: 0; padding: 0 0.75rem; background: none; border: none; cursor: pointer; color: var(--color-neutral); display: flex; align-items: center; justify-content: center; } .search-button:hover { color: var(--color-text); } .filters { display: flex; align-items: center; } .filters select { padding: 0.5rem; border: 1px solid var(--color-border); border-radius: 0.25rem; background-color: white; min-width: 150px; font-size: 0.875rem; } .sort-icon { margin-left: 0.25rem; opacity: 1; } th.active .sort-icon { opacity: 1; } .tooltip-container { position: relative; display: inline-block; } .tooltip-icon { border-bottom: 1px dotted var(--color-neutral); cursor: pointer; } .tooltip-text { visibility: hidden; position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%); background-color: var(--color-text); color: white; text-align: center; padding: 0.5rem; border-radius: 0.25rem; width: 200px; z-index: 1; font-size: 0.8rem; opacity: 0; transition: opacity 0.3s; } .tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; } /* Enhanced Table Styles */ .table-container { background: white; border-radius: 0.5rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); overflow: hidden; } #sortable-table { width: 100%; border-collapse: collapse; } #sortable-table thead { background-color: var(--color-background); border-bottom: 2px solid var(--color-border); } #sortable-table th, #sortable-table td { padding: 1rem; text-align: left; } #sortable-table th { font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-neutral); cursor: pointer; } #sortable-table th:hover { color: var(--color-text); } #sortable-table tr { border-bottom: 1px solid var(--color-border); } #sortable-table tr:last-child { border-bottom: none; } #sortable-table tr:hover { background-color: var(--color-background); } .violations-group { display: flex; align-items: center; gap: 0.5rem; } /* Responsive Design */ @media (max-width: 768px) { .search-and-filters { flex-direction: column; align-items: stretch; } .search-box { max-width: none; } .filters { justify-content: center; } } /* No Results Styling */ .no-results-row { background-color: #f9fafb; } .no-results-message { text-align: center; padding: 2rem; } .no-results-message svg { color: #9ca3af; } .no-results-message h3 { margin-top: 0.5rem; font-size: 0.875rem; font-weight: 500; color: #111827; } .no-results-message p { margin-top: 0.25rem; font-size: 0.875rem; color: #6b7280; } .no-results-message button { margin-top: 1.5rem; padding: 0.5rem 1rem; border: none; border-radius: 0.375rem; font-size: 0.875rem; font-weight: 500; color: white; background-color: #2563eb; cursor: pointer; transition: background-color 0.2s; } .no-results-message button:hover { background-color: #1d4ed8; } .no-results-message button:focus { outline: none; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5); }