Skip to content

[pat-depends] newer versions don't work properly with native select / pat-select2 #1276

@david-batranu

Description

@david-batranu

In plone.staticresources==2.3.5 installed by Plone==6.1.4 pat-depends behaves in a broken manner:

<select name="myselect" multiple>
  <option>a</option>
  <option>b</option>
  <option>c</option>
</select>

<div class="pat-depends" data-pat-depends="myselect ~= a">Option A selected</div>
<div class="pat-depends" data-pat-depends="myselect ~= b">Option B selected</div>
<div class="pat-depends" data-pat-depends="myselect ~= c">Option C selected</div>

pat-depends reads the select value from myselect.value which is a single string with the value of the first selected option. In the example above, selecting all options would result in only "Option A selected" being displayed. Selecting all BUT a would result in "Option B selected". This also occurs if binding to a <select class="pat-select2" multiple>.

I am using a select wrapper (https://github.com/Mobius1/Selectr/ - i know is archived but it still does it's job properly) that sends change event on the underlying select when the value changes but the latest version of pat-depends only ever intercepts input. I can make it work if I wrap the Selectr change event and trigger new Event("input") but that seems absurd to me.

I did consider upgrading from Selectr to pat-select2 however, as described above that would also be broken and only partially solve the issues.

I had to downgrade to plone.staticresources==2.2.5 to gain back functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions