[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 8295248: JEditorPane HTML form with multi-selection broke data after resetting [v3]
From:       Toshio Nakamura <tnakamura () openjdk ! org>
Date:       2022-10-31 9:15:24
Message-ID: P3gHPbPqyUJKnABlOsUNKE8fR9z3PNUESzXMH6OpEpQ=.ccf52138-8046-4599-9edb-59c8f05e4496 () github ! com
[Download RAW message or body]

On Mon, 24 Oct 2022 02:06:23 GMT, Toshio Nakamura <tnakamura@openjdk.org> wrote:

> > When JEditorPane shown HTML form with multi-selection, the reset operation broke \
> > its data. 
> > The sample testcase were attached in JBS. The recreate steps are below:
> > 1. The sample shows a multi-selection form with 5 items.
> > 2. Select the 4th item.
> > 3. Press the reset button.
> > Actual: The 4th item is still selected.
> > Expect: No item should be selected. Resetting operation may move to the initial \
> > state. The sample doesn't use 'selected' property in each option tag. 4. Just \
> >                 after the step 3, move the focus to outside of the application \
> >                 and back.
> > Actual: The 2nd item is selected. It means inside data indicates so.
> > Expect: No item is selected.
> > 
> > There are two issues. The current method `OptionListModel.removeIndexInterval()` \
> > removed the indexed item, and shifted the rest. Then, selection values were \
> > corrupted. I think the clear selection method `OptionListModel.clearSelection()` \
> > is suitable here. 
> > Test: jdk_desktop on macOS (x64, Monterey), Linux (x64, RHEL8), and Windows (x64, \
> > 2012R2). No regression found
> 
> Toshio Nakamura has updated the pull request incrementally with one additional \
> commit since the last revision: 
> Fixed space

Tested with jwebserver. It shows logs like `GET /test.html?select=1&subtmi=submit \
HTTP/1.1`, and the selected items can be identified.

Test1: 5 items in HTML select form without property. Like,

<select size="5" multiple>
 <option>1</option>
 <option>2</option>
 <option>3</option>
 <option>4</option>
 <option>5</option>
</select>


1.1 Select and submit
> selected item(s)|results w/o patch |results w/ patch |
> -------------- | ------- | ------ | 
> 1               |1        |1       |
> 2               |2        |2       |
> 3               |3        |3       |
> 4               |4        |4       |
> 5               |5        |5       |
> 1,2,3,4,5    |1,2,3,4,5 |1,2,3,4,5 |

1.2. Select, _reset_ and submit
> selected item(s)|w/o patch|w/ patch|
> -------------- | ------- | ------ | 
> 1               |none     |none    |
> 2               |**1**     |none    |
> 3               |none     |none    |
> 4               |**2**     |none    |
> 5               |none     |none    |
> 1,2,3,4,5    |**1,2**  |none    |

Test2: 5 items in HTML select form with 'selected' property at the first items. Like,

<select size="5" multiple>
 <option selected>1</option>
 <option>2</option>
 <option>3</option>
 <option>4</option>
 <option>5</option>
</select>


2.1 Select and submit
> selected item(s)|w/o patch|w/ patch|
> -------------- | ------- | ------ | 
> 1               |1        |1       |
> 2               |2        |2       |
> 3               |3        |3       |
> 4               |4        |4       |
> 5               |5        |5       |
> 1,2,3,4,5   |1,2,3,4,5 |1,2,3,4,5 |

2.2 Select, _reset_ and submit
> selected item(s)|w/o patch|w/ patch|
> -------------- | ------- | ------ | 
> 1               |1        |1       |
> 2               |1        |1       |
> 3               |1        |1       |
> 4               |**1,2**    |1       |
> 5               |1        |1       |
> 1,2,3,4,5    |**1,2**    |1       |

Bold marked cases have the problem, and this patch can solve it.

-------------

PR: https://git.openjdk.org/jdk/pull/10685


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic