scientificware / jdk

Read-only mirror of https://hg.openjdk.java.net/jdk/jdk
GNU General Public License v2.0
0 stars 0 forks source link

JDK-8314731 : Add support for the alt attribute in the image type input HTML tag #26

Open scientificware opened 1 year ago

scientificware commented 1 year ago

This is referenced in Java Bug Database as

This is tracked in JBS as

According HTML 3.2 specification

alt is not an attribute of the input element.

According HTML 4.01 specifications :

... For accessibility reasons, authors should provide alternate text for the image via the alt attribute. ...

This feature in not implemented in FormView.java.

Screenshot_20230817_025316

Left before the patch and right after the patch.

Related Pull Request :

Related Issue Report :

⚠️ This also affects the HTML 32 DTD

Click here to see the code ``` 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 = """

"""; Document doc = kit.createDefaultDocument(); jEditorPane.setDocument(doc); jEditorPane.setText(htmlString); JFrame jf = new JFrame("CSS named colors Test"); jf.getContentPane().add(scrollPane, BorderLayout.CENTER); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(new Dimension(400,200)); jf.setLocationRelativeTo(null); jf.setVisible(true); } }); } } ```

The image to use with de code above, save it with the name : oracle_logo_50x50.jpg oracle_logo_50x50.jpg

Status

scientificware commented 7 months ago

The unit test :