Skip to content

ImageResource2x.getSafeHtml caches the first alt text, so image button columns repeat one row's alt text #19332

Closed

Description

@gtritchie

Found while reviewing #19329.

System details

RStudio Edition : Desktop or Server
RStudio Version : all current releases
OS Version      : any
R Version       : any

Describe the problem in detail

ImageResource2x.getSafeHtml(String altText) builds its <img> markup once and caches it in html_, ignoring the altText of every later call (src/gwt/src/org/rstudio/core/client/resources/ImageResource2x.java, getSafeHtml).

ImageButtonColumn holds a single ImageResource2x per column and calls getSafeHtml(titleProvider_.get(value)) for each row (src/gwt/src/org/rstudio/core/client/cellview/ImageButtonColumn.java, ImageButtonCell.render). So every row's image gets the alt text of the first row rendered. The surrounding <span title> is per-row and correct; only the image's alt text is stale.

Affected columns with per-row titles, in the Packages pane:

  • the Help column, whose title is the package's URL
  • the Browse column, whose title is derived from the package's source and browse URL

The Remove column and the Connections pane's Explore column pass a constant title, so they are unaffected.

Expected

Each row's image carries that row's alt text, or the image is marked decorative if the per-row name is carried elsewhere.

Notes on fixing

Either key the cache on altText (or only cache the no-argument form), or have ImageButtonCell build its own <img>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions