On Wed, 30 Aug 2023 14:20:41 GMT, ScientificWare <d...@openjdk.org> wrote:
>> 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_ora... > > ScientificWare has updated the pull request incrementally with one additional > commit since the last revision: > > Update src/java.desktop/share/classes/javax/swing/text/html/FormView.java > > FormView.java : Remove a redundant space. > > Co-authored-by: Andrey Turbanov <turban...@gmail.com> Can you write a regression test for it? src/java.desktop/share/classes/javax/swing/text/html/FormView.java line 282: > 280: @SuppressWarnings("deprecation") > 281: URL srcURL = new URL(base, srcAtt); > 282: ImageIcon icon = new ImageIcon(srcURL); You should probably pass `altAtt` as the `description` parameter, yet I'm unsure if it's ever used in this context. src/java.desktop/share/classes/javax/swing/text/html/FormView.java line 283: > 281: URL srcURL = new URL(base, srcAtt); > 282: ImageIcon icon = new ImageIcon(srcURL); > 283: button = icon.getImageLoadStatus() == > MediaTracker.COMPLETE ? new JButton(icon) : new JButton(altAtt); Initially I thought the status could change, it can't. Looks good to me. src/java.desktop/share/classes/javax/swing/text/html/FormView.java line 285: > 283: button = icon.getImageLoadStatus() == > MediaTracker.COMPLETE ? new JButton(icon) : new JButton(altAtt); > 284: } catch (MalformedURLException e) { > 285: button = new JButton(srcAtt); Suggestion: button = new JButton(altAtt); If `altAtt` is provided, it should be used to handle invalid `srcAtt` too. ------------- Changes requested by aivanov (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/15319#pullrequestreview-1650659110 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1341292119 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1341310689 PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1341317037