-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rework behaviours to not reference elements outside of their behaviours to fix out of sync stuff with Hotwire Turbo #46
Labels
Comments
Ambient-Impact
added
bug
Something isn't working
enhancement
New feature or request
labels
Nov 9, 2023
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-site-theme
that referenced
this issue
Nov 9, 2023
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-block
that referenced
this issue
Nov 9, 2023
We also log a warning to the console so that this kind of state error doesn't get swept under the rug and is easier to find. See neurocracy/omnipedia#46
Ambient-Impact
added a commit
that referenced
this issue
Nov 10, 2023
- Upgrading drupal/omnipedia_block (6.x-dev ec3fed1 => 6.x-dev 2b3a3a7): Existing privacy toggle no longer causes behaviour return; is removed: We also log a warning to the console so that this kind of state error doesn't get swept under the rug and is easier to find. - Upgrading drupal/omnipedia_site_theme (6.x-dev 165b971 => 6.x-dev c206989): Removed tracking of whether behaviours are attached; hides errors.
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-site-theme
that referenced
this issue
Jan 15, 2024
- Now detaches and re-attaches without issues. - Correctly hides the overlay if open when detached so that scroll blocking and ally.maintain.disabled are disengaged. - Reworked into JavaScript classes and event subscribers. - Focus locking now works more reliably in most cases; still shows when the pop-up is auto shown by the module's JavaScript, but that can be fixed later with a rework of focus hiding. See: neurocracy/omnipedia#46
Ambient-Impact
added a commit
that referenced
this issue
Jan 15, 2024
…477): Near complete rewrite of EU Cookie Compliance JS for reliability: - Now detaches and re-attaches without issues. - Correctly hides the overlay if open when detached so that scroll blocking and ally.maintain.disabled are disengaged. - Reworked into JavaScript classes and event subscribers. - Focus locking now works more reliably in most cases; still shows when the pop-up is auto shown by the module's JavaScript, but that can be fixed later with a rework of focus hiding. See issue #46.
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-site-theme
that referenced
this issue
Jan 18, 2024
- Now detaches and re-attaches without issues. - Correctly hides the overlay if open when detached so that scroll blocking and ally.maintain.disabled are disengaged. - Reworked into JavaScript classes and event subscribers. - Focus locking now works more reliably in most cases; still shows when the pop-up is auto shown by the module's JavaScript, but that can be fixed later with a rework of focus hiding. See: neurocracy/omnipedia#46
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-site-theme
that referenced
this issue
Jan 18, 2024
- Refactored as JavaScript classes. - Everything is now scoped to behaviours without references to instances outside of said behaviours; this is primarily achieved by instantiating classes and assigning them to a property on elements we attach to, and then destroyed when the behaviour detaches. - Did I mention hella object-oriented? See: neurocracy/omnipedia#46
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-site-theme
that referenced
this issue
Jan 19, 2024
The events still bubble up to it so no other changes are needed. See neurocracy/omnipedia#46
Ambient-Impact
added a commit
to neurocracy/drupal-omnipedia-site-theme
that referenced
this issue
Jan 19, 2024
The events still bubble up to it so no other changes are needed. See neurocracy/omnipedia#46
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In developing the Hotwire Turbo integration for the RefreshLess module, certain faulty assumptions have been revealed in various behaviours across our custom modules and the site theme; namely that we're relying on behaviours to find elements, store references to them, and then provide methods on the component to fetch those - this works fine most of the time if we only have to worry about full page loads, but this can break if a behaviour has been detached and a method is called to fetch an element, or if the method is called before a detach and the calling code stores a reference to that element, which will no longer exist in the DOM if Turbo has navigated to another page, and so on.
Solutions
The primary reason to have those methods on the components is that components are easy to reference from other code, but there's no single, easy way to reference specific elements in other code that it's expecting a component to provide.
One solution may be to finally rebuild everything using Stimulus, which may make it easier to properly contain and scope elements, but actually referencing elements directly is still a bit of an issue; they recommend using events to communicate between controllers, which may work, but further investigation is needed.
The text was updated successfully, but these errors were encountered: