Skip to content

fix: make initially disabled toolbar controls clickable after enabling - #1759

Open
rayw-lab wants to merge 1 commit into
geoman-io:developfrom
rayw-lab:codex/enable-initially-disabled-controls
Open

rayw-lab wants to merge 1 commit into
geoman-io:developfrom
rayw-lab:codex/enable-initially-disabled-controls

Conversation

@rayw-lab

Copy link
Copy Markdown

Description

A toolbar button that starts disabled can look enabled later without responding to clicks. When it is first rendered, the button and its action links do not get click handlers.

Register those handlers during rendering and check the current disabled state when they run. The existing toolbar element can then be enabled and used without rebuilding it.

Related Issue

Refs #1161. This covers controls disabled before their first render.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the code style of this project (pnpm run lint:check)
  • I have tested my changes locally
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes (pnpm run test:all)

Additional Notes

In Chrome with Leaflet 1.9.4, the initially disabled control begins working after it is enabled, and its cancel action works too. The build, lint, type check, 94 unit tests, and all 22 Cypress toolbar tests passed. The toolbar tests include an action that stops later listeners with stopImmediatePropagation().

This branch has not been deployed

No deployments
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.

1 participant