Improve doc-string for `Image::alt_text`

This commit is contained in:
Emil Ernerfeldt 2025-07-07 12:06:59 +02:00
parent 93d562221b
commit 933d305159
1 changed files with 5 additions and 4 deletions

View File

@ -278,7 +278,8 @@ impl<'a> Image<'a> {
}
/// Set alt text for the image. This will be shown when the image fails to load.
/// It will also be read to screen readers.
///
/// It will also be used for accessibility (e.g. read by screen readers).
#[inline]
pub fn alt_text(mut self, label: impl Into<String>) -> Self {
self.alt_text = Some(label.into());
@ -672,7 +673,7 @@ pub fn paint_texture_load_result(
rect: Rect,
show_loading_spinner: Option<bool>,
options: &ImageOptions,
alt: Option<&str>,
alt_text: Option<&str>,
) {
match tlr {
Ok(TexturePoll::Ready { texture }) => {
@ -697,9 +698,9 @@ pub fn paint_texture_load_result(
0.0,
TextFormat::simple(font_id.clone(), ui.visuals().error_fg_color),
);
if let Some(alt) = alt {
if let Some(alt_text) = alt_text {
job.append(
alt,
alt_text,
ui.spacing().item_spacing.x,
TextFormat::simple(font_id, ui.visuals().text_color()),
);