Skip to content

Fix keyboard conflicts, async error handling, and profile validation#6

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-keyboard-shortcut-conflict
Draft

Fix keyboard conflicts, async error handling, and profile validation#6
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-keyboard-shortcut-conflict

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 14, 2026

Addresses keyboard shortcut conflicts with browser defaults, race conditions in async extension toggle logic, inadequate profile name validation allowing reserved prefixes in imports, and CSS rule conflicts.

Keyboard Shortcuts

  • Popup: Ctrl+A → Ctrl+Shift+A (avoids native Select All)
  • Global: Ctrl+Shift+T → Ctrl+Shift+U (avoids Chrome reopen-tab)
  • Added comment documenting architectural difference between vm.switch.flip() (UI observables) and performToggle() (background service worker)

Async Error Handling (migration.js)

Fixed ineffective try/catch on promise-returning chrome.management.setEnabled():

// Before: race condition, loses failed IDs
toggled.forEach(id => {
  try {
    chrome.management.setEnabled(id, true);
  } catch(e) { ... }
});
chrome.storage.sync.set({toggled: []});

// After: track failures, retry only failed
Promise.allSettled(toggled.map(id =>
  chrome.management.setEnabled(id, true)
    .then(() => ({ id, status: 'success' }))
    .catch(err => ({ id, status: 'failed' }))
)).then(results => {
  const failedIds = results
    .filter(r => r.value.status === 'failed')
    .map(r => r.value.id);
  chrome.storage.sync.set({toggled: failedIds}, callback);
});

Added error handlers to all chrome.storage.sync.set calls.

Profile Validation

  • Created reusable validateProfileName(): rejects "__" prefix, enforces 30-char limit, trims whitespace
  • exportProfiles: filters out reserved profiles (!name.startsWith('__'))
  • importProfiles: validates before adding, skips invalid names
  • self.add(): accepts internal flag to allow reserved names only from internal calls (e.g., selectReserved)

CSS Consolidation

Resolved conflicting display/visibility rules:

  • Import feedback: ID-specific selectors (#import-result.visible, #import-error.visible) with display: block
  • General utilities: .visible, .hidden, .fadeout with visibility for animations
  • Removed duplicate rules causing override issues

Documentation

Updated Update.md priority status to reflect completed Manifest V3 migration, CSP, and error handling (0/3 → 3/3).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 14, 2026 13:33
Co-authored-by: diluteoxygen <82773456+diluteoxygen@users.noreply.github.com>
…Settled

Co-authored-by: diluteoxygen <82773456+diluteoxygen@users.noreply.github.com>
Co-authored-by: diluteoxygen <82773456+diluteoxygen@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix keyboard shortcut conflict and enhance toggle logic Fix keyboard conflicts, async error handling, and profile validation Feb 14, 2026
Copilot AI requested a review from diluteoxygen February 14, 2026 13:38
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.

2 participants