Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPIKE] Explore progressively enhanced file upload component #5305

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

querkmachine
Copy link
Member

@querkmachine querkmachine commented Sep 10, 2024

As part of post-audit investigations, a spike into layering a new UI onto the File upload component that should be a bit more friendly to assistive technologies. alphagov/govuk-design-system#4031

Note: This hasn't actually been tested across browsers and ATs yet,

Changes

  • Progressively enhances the file input of the File upload component with a custom button and file selection display.
    • This new UI localisable. This adds the potential for buttons to better describe what needs uploading.
    • As much as possible, this new UI behaves similarly to the browser's native controls (e.g. can click on the label or input text to activate the component; supports multiple, accepts and capture attributes; etc.)
  • Adds a visual drop zone if a file is dragged over the input.

Thoughts

  • There are some features that are not supported yet. For example, the button will still appear useable even if the underlying input has been disabled.
  • The native file input is visually hidden but is still exposed to screen readers. I wasn't sure if I could (or should) hide it from them, as it may contain context that the 'enhanced' controls do not. Further testing needed.
  • This has been developed to pretty closely resemble native file inputs as they appear in Chromium browsers. We may be interested in styling them more similarly to other form inputs (e.g. having a black border around it.)
  • The visual drop zone currently only appears when dragging over the input itself. It may be preferable for it to appear if a file is dragged over anywhere on the page.

Copy link

github-actions bot commented Sep 10, 2024

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 119.16 KiB
dist/govuk-frontend-development.min.js 45.97 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 94.79 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 89.02 KiB
packages/govuk-frontend/dist/govuk/all.mjs 1.12 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 119.14 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 45.96 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB
packages/govuk-frontend/dist/govuk/init.mjs 5.34 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 85.85 KiB 43.67 KiB
accordion.mjs 23.5 KiB 12.39 KiB
button.mjs 5.98 KiB 2.69 KiB
character-count.mjs 22.4 KiB 9.92 KiB
checkboxes.mjs 5.83 KiB 2.83 KiB
error-summary.mjs 7.89 KiB 3.46 KiB
exit-this-page.mjs 17.1 KiB 9.26 KiB
file-upload.mjs 13.77 KiB 6.87 KiB
header.mjs 4.46 KiB 2.6 KiB
notification-banner.mjs 6.26 KiB 2.62 KiB
password-input.mjs 15.15 KiB 7.25 KiB
radios.mjs 4.83 KiB 2.38 KiB
service-navigation.mjs 4.46 KiB 2.69 KiB
skip-link.mjs 4.39 KiB 2.18 KiB
tabs.mjs 10.05 KiB 6.06 KiB

View stats and visualisations on the review app


Action run for 8fe1f08

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate solution for operating the file upload component with Dragon
2 participants