• Select dropdowns inside .postbox selectors get initialized when firing the postbox-toggled event. That means that on first pageload of a post edit backend page, a select dropdown inside a postbox will not get chosen initialized. However, after closing and opening the postbox, chosen gets initialized. This can be considered an odd behavior.

    As a sidenote for this: it might not be a good idea to destroy and re-initialize on each dropdown each time a postbox is toggled. I have solved similar ptoblems by:
    * checking that the postbox being toggled holds the classname closed or not.
    * adding a flag classname to the select item when initializing the script so this only happens just once.

    In addition, I would propose having a classname that could be used as a selector to prevent initialization. Some plugins include select2 as a helper library on specific dropdowns, and when they belong to a postbox container, closing and opening the box means that a single select2 instance becomes a chosen instance followed by the select2 one. In short, targetting all dropdowns inside a postbox without a way to opt out might not be a good idea.

Viewing 1 replies (of 1 total)
  • Plugin Author John James Jacoby

    (@johnjamesjacoby)

    Hey @jadpm! This is good feedback. I’ll prioritize avoiding Select2 conflicts for the next release.

    The postbox toggle problem *should* be resolved in 2.0.0. If not, I’d like to track them down and fix them, so any info you have about how to duplicate what you’re seeing will be helpful.

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Disable on specific selectors, odd inside postbox behavior’ is closed to new replies.