Use the new isTriggerInteractive tooltip prop

This commit is contained in:
Robin
2024-01-10 10:46:13 -05:00
parent d3825648f2
commit d4780b2d63
4 changed files with 13 additions and 17 deletions

View File

@@ -15,6 +15,7 @@ limitations under the License.
*/ */
.lock { .lock {
display: block;
padding: var(--cpd-space-1x); padding: var(--cpd-space-1x);
border-radius: var(--cpd-radius-pill-effect); border-radius: var(--cpd-radius-pill-effect);
} }

View File

@@ -32,19 +32,13 @@ export const EncryptionLock: FC<Props> = ({ encrypted }) => {
const label = encrypted ? t("common.encrypted") : t("common.unencrypted"); const label = encrypted ? t("common.encrypted") : t("common.unencrypted");
return ( return (
<Tooltip label={label} side="right"> <Tooltip label={label} side="right" isTriggerInteractive={false}>
<Icon <Icon
width={16} width={16}
height={16} height={16}
className={styles.lock} className={styles.lock}
data-encrypted={encrypted} data-encrypted={encrypted}
aria-label={label} aria-label={label}
// Make the icon focusable so that the tooltip can be opened
// with keyboard navigation
// TODO: Replace this with the solution from
// https://github.com/vector-im/compound-web/pull/130 once it
// lands
tabIndex={0}
/> />
</Tooltip> </Tooltip>
); );

View File

@@ -158,7 +158,8 @@ unconditionally select the container so we can use cqmin units */
max-inline-size: 100%; max-inline-size: 100%;
} }
.nameTag > svg { .nameTag > svg,
.nameTag > span {
flex-shrink: 0; flex-shrink: 0;
} }
@@ -170,14 +171,16 @@ unconditionally select the container so we can use cqmin units */
color: var(--cpd-color-icon-primary); color: var(--cpd-color-icon-primary);
} }
.nameTag span { .nameTag > .name {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
padding-inline: var(--cpd-space-2x); padding-inline: var(--cpd-space-2x);
flex-shrink: 1;
} }
.errorIcon { .errorIcon {
display: block;
color: var(--cpd-color-icon-critical-primary); color: var(--cpd-color-icon-critical-primary);
} }

View File

@@ -148,22 +148,20 @@ const Tile = forwardRef<HTMLDivElement, TileProps>(
<div className={styles.fg}> <div className={styles.fg}>
<div className={styles.nameTag}> <div className={styles.nameTag}>
{nameTagLeadingIcon} {nameTagLeadingIcon}
<Text as="span" size="sm" weight="medium"> <Text as="span" size="sm" weight="medium" className={styles.name}>
{nameTag} {nameTag}
</Text> </Text>
{unencryptedWarning && ( {unencryptedWarning && (
<Tooltip label={t("common.unencrypted")} side="bottom"> <Tooltip
label={t("common.unencrypted")}
side="bottom"
isTriggerInteractive={false}
>
<ErrorIcon <ErrorIcon
width={20} width={20}
height={20} height={20}
aria-label={t("common.unencrypted")} aria-label={t("common.unencrypted")}
className={styles.errorIcon} className={styles.errorIcon}
// Make the icon focusable so that the tooltip can be opened
// with keyboard navigation
// TODO: Replace this with the solution from
// https://github.com/vector-im/compound-web/pull/130 once it
// lands
tabIndex={0}
/> />
</Tooltip> </Tooltip>
)} )}