On Tue, 10 Nov 2026 10:47:42 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> The transfer handler installed by BasicListUI, inserts list values directly 
> into the HTML clipboard representation without escaping HTML special 
> characters, which is incorrect if the list values doesn't have `<html>` tag.
> For example, a list item containing `<b>Hello</b>` should be displayed as 
> literal text by the default renderer when it does not begin with `<html>`. 
> Copying the item produces:
> `<li><b>Hello</b>` so an HTML-aware application will see **Hello** in bold as 
> receiving application interprets `<b>` as formatting tag, whereas without 
> `<html>` tag the application should see it as literal `<b>Hello</b>`. 
> Seeing only **Hello** in bold means the paste operation interpreted part of 
> the text as formatting and hid the literal `<b> and </b>` characters
> 
> This is because `BasicListUI.ListTransferHandler.createTransferable()` 
> appends each model value’s `toString() `directly after `<li>`. Consequently, 
> literal tags become markup, and strings such as `&lt;`  gets decoded when 
> pasted through the HTML flavor.
> The fix is to make the HTML clipboard version represent the original text 
> correctly by escaping html tags when explicit `<html>` tag is not used
> while preserving intentional and explicit HTML values when `<html>` tag is 
> used
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

@azuev-java @jayathirthrao please review

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

PR Comment: https://git.openjdk.org/jdk/pull/33814#issuecomment-6765753523

Reply via email to