From c6d874ae991ae3d45e1e09987524ecb6290a63bb Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Fri, 24 Jan 2025 17:10:32 -0800 Subject: [PATCH] rx.logo: make it accessible to screen readers Add role="img" aria_label="Reflex" and title="Reflex". --- reflex/components/datadisplay/logo.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/reflex/components/datadisplay/logo.py b/reflex/components/datadisplay/logo.py index d960b8cee..e1f131f4e 100644 --- a/reflex/components/datadisplay/logo.py +++ b/reflex/components/datadisplay/logo.py @@ -5,11 +5,15 @@ from typing import Union import reflex as rx -def svg_logo(color: Union[str, rx.Var[str]] = rx.color_mode_cond("#110F1F", "white")): +def svg_logo( + color: Union[str, rx.Var[str]] = rx.color_mode_cond("#110F1F", "white"), + **props, +): """A Reflex logo SVG. Args: color: The color of the logo. + props: Extra props to pass to the svg component. Returns: The Reflex logo SVG. @@ -31,11 +35,14 @@ def svg_logo(color: Union[str, rx.Var[str]] = rx.color_mode_cond("#110F1F", "whi return rx.el.svg( *[logo_path(d) for d in paths], - width="56", - height="12", - viewBox="0 0 56 12", + rx.el.title("Reflex"), + aria_label="Reflex", + role="img", + width=props.pop("width", "56"), + height=props.pop("height", "12"), fill=color, xmlns="http://www.w3.org/2000/svg", + **props, )