Skip to content

Release Select2 4.1.0-rc.0 - #5975

Merged
kevin-brown merged 19 commits into
masterfrom
develop
Jan 23, 2021
Merged

Release Select2 4.1.0-rc.0#5975
kevin-brown merged 19 commits into
masterfrom
develop

Conversation

@kevin-brown

Copy link
Copy Markdown
Member

No description provided.

laryn and others added 19 commits June 8, 2020 09:43
* Created te.js

Created Telugu language translation.
This pull request is Translation only.
The following changes were made
- Created Telugu Messages.

* Created te.js

Created Telugu language translation.
This pull request is Translation only.
Co-authored-by: Anthonius Alfred Andreas <[email protected]>
removeItem was missing
* Add aria-label 'Search' to search input when dropdown opens.

* Fixex per review comments. Added test cases.
…ltiple selects (#5964)

* Switch clear button to no longer be floated

This also adds a consistent padding to the right side of the selection
area to allow the clear button to be absolutely positioned on the right
side without having to worry about it colliding with one of the
selected elements. This is not ideal since it always shows up, even
when the clear button is not enabled. This is also not ideal since
it maintains the padding for the second row and beyond, even though
the clear button is not visible on those rows.

We can see if we can work through those issues later. But for now
it's working consistent in both Chrome and IE.

* Set max-width to 100% on search box

This should keep the search box set so it does not overflow the
container that it is held within. So when people search for incredibly
long strings, it properly maintains width and does not break out of
the container and cause rendering issues.

* Set max-width on the individual selections

This sets the max width on the individual selections such that
selections with abnormally long width will not exceed the size of
the container and break rendering. In order to remain consistent with
how the display is done for a single select, we do not allow the
contents of selection in a multiple select to break across lines.

In order to fix a rendering issue that occurs when the `overflow`
is set to anything other than `visible` on the list item, we set
`vertical-align` to `baseline` to ensure that all of the list items
are vertically aligned to the same location. If we don't set this, a
channel that is roughly 5px tall starts to form between the rows. It's
not clear what causes this channel to form but the current solution
for working around it is to correct the vertical alignment which
appears to cause it to collapse and not form.

* Fix remove icon on selection pushing long text

This fixes an issue we saw with long text where if the text of the]
selection was long enough, the close icon for the selection would
be pushed to a second row. This is because the close icon was set
to display as a block-like element and that will cause it to take
it's own row when it needs to. Now we are absolutely positioning the
clear icon with a padding applied so it always renders where we would
normally expect it to.
There was a very slow memory leak that can occur if you were creating
and destroying many Select2 elements on a single page. This was caused
by the internal Select2 cache not being cleared for the container
element, causing a reference to it to be left in memory even after
the Select2 element was destroyed.

The memory was put in place to make it easier to destroy a Select2
element after it is initialized, specifically when the user clicks
off of the Select2 element. Because some pages run with multiple
versions of Select2 and jQuery at the same time, we specifically
cache a local copy of the jQuery element to allow it to be
deconflicted at the time of the call. This cached locally copy was
not being properly cleared when Select2 was being destroyed though,
which had the (very small) potential to cause a memory leak over time.
…5806)

* Fixes #3712 Allowing Pasting tags from spreadsheet

I was trying to make an easy way for clients to copy and paste tags from a spreadsheet, but I was unable to do this because select2's use of a 'search' input would remove all newline characters from the pasted input. replacing the search text input with a textarea removes this limitation.

* Fixes bug and broken tests

* Missed one spot

* Fixes tests posibly?

* reformat long lines

* Reference options instead of searchElement directly

* make input come first in selector

* Make textarea the default rather than a configurable

* fix weird whitespace

* missing a quote

* Fix styling to be closer to the default for search boxes

This still has an issue with overflows and how the browser will
completely shift focus rather than slowly move it character by
character, but this is something which we can work out at a later
time and shouldn't break things for now.

* Fix tests expecting to find an input

* Skip autocomplete property tests

These tests currently fail in the automated test runner because they
are checking the `autocomplete` property on the `<textarea>` DOM
element. This attribute is widely supported across our supported
browsers, but the property on the JS DOM element has only recently
started to be supported. As a result, the virtual browser used by the
test runner does not support this property and cannot read it for the
tests.

* Fix placeholder test returning incorrect width

The width was incorrect for the placeholders because it was using the
default browser style instead of the ones from Select2. As a result, it
was coming back with a width of 104 because it was at 100% of 100px
with the default 2px padding all around that is browser by the browser
user style sheets. Now that it is being placed inside of the proper
container, we can see that the expected styles are being applied.

* Introduce new class to better handle the clear button

This new class allows us to not have to apply the padding for the
clear icon when the clear icon is not being displayed.

* Update test with proper width of the search box

Co-authored-by: Kevin Brown <[email protected]>
Co-authored-by: Andrew Colchagoff <[email protected]>
Co-authored-by: Kevin Brown <[email protected]>
Updated Hungarian translation.
* refactor: check for unselected options when using tags and highlight that option first

* Switch to using a decorator for highlighting tags

This switches the implementation to use a decorator which is only
added when the `tags` option is set during initialization.
Functionally it has no change on the effect but it allows for the
logic to be more isolated. In the end it just keeps it more organized
and works towards cutting back on what is included in the core results.

This also changes the call for setting the `select2-data-tag` attribute
to properly set the attribute as a string instead of relying on the
boolean to string conversion.

* Fix tabbing in newly added decorator

* Add tests for tag focusing in results

Co-authored-by: Kevin Brown <[email protected]>
This sets the title of the rendered selection for a placeholder when
it is displayed within a single select. This is not necessary for a
multiple select because the placeholder is set on the search box
which will properly convey the value of it and meets ARIA guidelines.

Because single select boxes currently use a `textbox` role to convey
the keyboard accessibility of the textbox area, and because that role
is currently required in ARIA 1.1, it must be properly labelled using
the `title`, `aria-label`, or `aria-labelledby` attribute. This
currently happens for single selects without a placeholder, and
single selects with a placeholder but with an active selection,
because the `title` attribute is set to the title of the active
selection. Because it only currently sets it for the active selection,
this caused an edge case specific to placeholders for single selects
where the selection was not properly labelled.

The placeholder title follows the same rules for setting the attribute
value as for the regular single select selection, except placeholders
will also fall back to just using the text value of the placeholder
element in the event that the `title` and `text` attributes are not
specified on the placeholder data option.
@kevin-brown
kevin-brown merged commit 9ce61fd into master Jan 23, 2021
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.