Skip to content

Fix issues with multiple or DOM-injected CTBs#38

Merged
circlecube merged 1 commit intomainfrom
fix/ctb
Mar 27, 2025
Merged

Fix issues with multiple or DOM-injected CTBs#38
circlecube merged 1 commit intomainfrom
fix/ctb

Conversation

@wpscholar
Copy link
Copy Markdown
Member

Proposed changes

Resolves PRESS10-163 and PRESS11-196.

  • Resolves issue where second CTB with same ID wasn't triggering.
  • Resolves issue where React DOM-rendered CTBs weren't triggering.

To test:

  • Use Chrome browser overrides to replace the CSS and JS files
  • Run through the replication steps for both tickets linked above.

Type of Change

Production

  • Bugfix (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)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issues with multiple CTB triggers and React DOM-injected CTBs by updating how the CTB elements are queried, disabled, and re-enabled, and by streamlining the modal management and event handling logic.

  • Consolidated CTB element handling for both native and injected cases
  • Updated error handling and modal management functions
  • Improved event delegation for CTB and modal close actions
Files not reviewed (1)
  • static/ctb.css: Language not supported
Comments suppressed due to low confidence (2)

static/ctb.js:6

  • [nitpick] The global variable 'ctbmodal' is ambiguous; consider renaming it to 'ctbModal' for improved clarity and consistency with camelCase naming conventions.
let ctbmodal;

static/ctb.js:139

  • Directly outputting 'error' may result in non-informative messages (e.g. "[object Object]") if error is an object; consider checking if error.message exists and using that for a clearer error message.
          <h3>${error}</h3>

@wpscholar wpscholar changed the title Fix issues with multiple or DOM-injected CTBS Fix issues with multiple or DOM-injected CTBs Mar 27, 2025
@circlecube circlecube merged commit 9b950c0 into main Mar 27, 2025
2 of 3 checks passed
@circlecube circlecube deleted the fix/ctb branch March 27, 2025 21:20
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.

3 participants