Skip to content

Integrate HTML switch element polyfill for OuiCheckbox#2

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/integrate-html-switch-polyfill
Draft

Integrate HTML switch element polyfill for OuiCheckbox#2
Copilot wants to merge 4 commits intomasterfrom
copilot/integrate-html-switch-polyfill

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 13, 2026

Adds support for the native HTML switch element (<input type="checkbox" switch>) via the input-switch-polyfill package, enabling modern switch semantics with proper ARIA roles and accessibility features.

Changes

  • Added dependency: input-switch-polyfill@1.9.0
  • Created polyfill loader (lib/basic/switch-polyfill.ts): Conditionally loads polyfill when 'switch' in HTMLInputElement.prototype is false
  • Updated OuiCheckbox: Adds switch attribute to input elements when switch prop is true
  • TypeScript definitions: Added type declarations for the polyfill module

Implementation

The polyfill initialization uses an async IIFE to avoid blocking module evaluation:

// lib/basic/switch-polyfill.ts
import 'input-switch-polyfill/input-switch-polyfill.css'

;(async () => {
  if (!('switch' in HTMLInputElement.prototype)) {
    await import('input-switch-polyfill')
  }
})()

The OuiCheckbox component now renders the native switch attribute:

<OuiCheckbox v-model="value" switch>
  Switch with label
</OuiCheckbox>

Renders as:

<input type="checkbox" switch class="oui-switch">

Screenshots

Unchecked state:
Switch unchecked

Checked state:
Switch checked

The polyfill provides drag-to-toggle interactions, accent color support, and enhanced contrast modes while maintaining zero overhead on browsers with native support.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • blog.tomayac.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Integrate polyfill for the HTML switch element</issue_title>
<issue_description>blog.tomayac.com: A polyfill for the HTML switch element (2026-01-13)

Update OuiCheckbox accordingly.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 13, 2026 19:58
Co-authored-by: holtwick <49557+holtwick@users.noreply.github.com>
Co-authored-by: holtwick <49557+holtwick@users.noreply.github.com>
Co-authored-by: holtwick <49557+holtwick@users.noreply.github.com>
Copilot AI changed the title [WIP] Integrate polyfill for the HTML switch element Integrate HTML switch element polyfill for OuiCheckbox Jan 13, 2026
Copilot AI requested a review from holtwick January 13, 2026 20:08
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.

Integrate polyfill for the HTML switch element

2 participants