UNPKG

axe-playwright-report

Version:

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

919 lines (778 loc) 16.3 kB
:root { --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; /* Blue */ --deafblind-color: #ff7f0e; /* Orange */ --mobility-color: #2ca02c; /* Green */ --low-vision-color: #d62728; /* Red */ --cognitive-color: #9467bd; /* Purple */ --colorblindness-color: #8c564b; /* Brown */ --deaf-color: #e377c2; /* Pink */ --attention-deficit-color: #7f7f7f; /* Gray */ --sighted-keyboard-users-color: #bcbd22; /* Olive */ --dyslexia-color: #17becf; /* Cyan */ } .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); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; color: var(--text); background-color: white; transition: all 0.3s ease; } .container { max-width: 1200px; margin: 0 auto; padding: 20px; } header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background-color: white; border-bottom: 1px solid var(--border); } .logo { font-size: 20px; font-weight: 700; color: var(--primary); } .header-actions { display: flex; align-items: center; gap: 20px; } nav { display: flex; background-color: var(--primary-light); padding: 10px 20px; } .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(--primary); 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: 30px; } .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: 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; } table { width: 100%; border-collapse: collapse; margin-bottom: 30px; background-color: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } th, td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); } th { background-color: var(--primary-light); font-weight: 600; } tr:hover { background-color: var(--gray); } .url-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .url-cell a { color: var(--primary); 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; } } /* Style 3 - Stats With Icons */ .icon-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin: 0 auto 40px auto; } .icon-card { background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 20px; display: flex; align-items: center; transition: all 0.2s ease; } .icon-card:hover { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15); } .card-icon { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 15px; 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; } .icon-title { margin: 0 0 5px 0; color: #666; font-size: 14px; font-weight: 600; } .icon-value { font-size: 28px; font-weight: bold; margin: 0; color: #333; }