Skip to content
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

InputAccordion duplicate elem_id handling #16381

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

w-e-w
Copy link
Collaborator

@w-e-w w-e-w commented Aug 13, 2024

Description

this implements handling of duplicate element IDs for InputAccordion

for more details about this issue read #16373

this PR makes InputAccordion function correctly if the issue described in #16373 were to occur, this would also forcibly modify the element ID by app ending a number
if an extension actually relies on the element ID for a specific use case for example inside JavaScript then the JavaScript will still not function
so this is just a "increase compatibility" but not a fix

extension should not rely on this
the real fixed requires manual modification with the use of #16373


with this PR
InputAccordion now tracks all previously used InputAccordion elem_id and if if it input ID is found to be a duplicate then it append a number at the end of the input id

a on_script_unloaded callback is added to clear / reset the accordion_id_set and global_index

the callback is registered here inside the init amd mpt oput side is becaluse ui_components, happens too early before callbacks can be registered
well if I really want to I can register the call back some other place in the script
but I feel like registering it somewhere else introduces more spaghetti in the code so I decided to put everything inside the class itself

Checklist:

@w-e-w
Copy link
Collaborator Author

w-e-w commented Aug 13, 2024

@light-and-ray I added I've implemented the auto resolving of duplicate elem_id for InputAccordion

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