RFR: JDK-8314731 : Add support for the alt attribute in the image type input HTML tag [v3]

ScientificWare duke at openjdk.org
Thu Nov 2 23:25:31 UTC 2023


> This is referenced in Java Bug Database as
> - [JDK-8314731 : Adds support for the alt attribute in the image type input HTML tag.](https://bugs.java.com/bugdatabase/view_bug?bug_id=8314731)
> 
> This is tracked in JBS as
> - [JDK-8314731 : Add support for the alt attribute in the image type input HTML tag](https://bugs.openjdk.java.net/browse/JDK-8314731)
> 
> According [HTML 3.2 specification](https://www.w3.org/TR/2018/SPSD-html32-20180315/#input)
> 
> `alt` is not an attribute of the `input` element.
> 
> According [HTML 4.01 specifications](https://www.w3.org/TR/html4/interact/forms.html#h-17.4) : 
> 
>> ... For accessibility reasons, authors should provide [alternate text](https://www.w3.org/TR/html4/struct/objects.html#alternate-text) for the image via the [alt](https://www.w3.org/TR/html4/struct/objects.html#adef-alt) attribute. ...
> 
> This feature is not implemented in `FormView.java`.
> 
> ⚠️  ~~This also affects the HTML 32 DTD~~
> 
> ![Screenshot_20230817_025316](https://github.com/openjdk/jdk/assets/19194678/8e580574-d842-4a65-884b-26e33cd12138)
> 
> Left before the patch and right after the patch.
> 
> 
> import java.awt.BorderLayout;
> import java.awt.Dimension;
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> import javax.swing.JScrollPane;
> import javax.swing.SwingUtilities;
> import javax.swing.text.Document;
> import javax.swing.text.html.HTMLEditorKit;
> import javax.swing.text.html.StyleSheet;
> 
> public class HTMLAddsSupportAltInputTag {
>   public static void main(String[] args) {
>     new HTMLAddsSupportAltInputTag();
>   }
>   
>   public HTMLAddsSupportAltInputTag() {
>     SwingUtilities.invokeLater(new Runnable(){
>       public void run(){
>         JEditorPane jEditorPane = new JEditorPane();
>         jEditorPane.setEditable(false);
>         JScrollPane scrollPane = new JScrollPane(jEditorPane);
>         HTMLEditorKit kit = new HTMLEditorKit();
>         jEditorPane.setEditorKit(kit);
>         StyleSheet styleSheet = kit.getStyleSheet();
>         styleSheet.addRule("""
>             body {
>                 color: #000;
>                 font-family:times;
>                 margin: 4px;
>             }
>             """);
>         String htmlString = """
>             <html>
>                 <body>
>                     <input type=image name=point src="file:oracle_logo_50x50.jpg" alt="Logo Oracle JPG">
>                     <p>
>                     <input type=image name=point src="file:none_oracle_logo_50x50.jpg" alt="Logo Oracle JPG">
>                     <p>
>                     <input type=image name=point src...

ScientificWare has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:

 - Merge master
 - FormView.java :
   - Pass altAtt as the description parameter in the ImageIcon constructor.
 - Merge branch 'scientificware-patch-006-HTML-adds_input_tag_image_type_alt_attribute_support' of github.com:scientificware/jdk into scientificware-patch-006-HTML-adds_input_tag_image_type_alt_attribute_support
 - Update src/java.desktop/share/classes/javax/swing/text/html/FormView.java
   
   FormView.java : Remove a redundant space.
   
   Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
 - Merge master
 - Merge master
 - Merge master
 - FormView.java :
   - Fall back to the src attribute if the alt attribute is missing.
 - FormView.java : Adds missing space in a while statement. Updates Copyright year.
 - Merge master
 - ... and 1 more: https://git.openjdk.org/jdk/compare/98c1c6dd...a3e8ce51

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15319/files
  - new: https://git.openjdk.org/jdk/pull/15319/files/0e08107b..a3e8ce51

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15319&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15319&range=01-02

  Stats: 219933 lines in 5760 files changed: 111084 ins; 48750 del; 60099 mod
  Patch: https://git.openjdk.org/jdk/pull/15319.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15319/head:pull/15319

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


More information about the client-libs-dev mailing list