diff --git a/webapp/channels/src/components/channel_header/channel_header_title_favorite.tsx b/webapp/channels/src/components/channel_header/channel_header_title_favorite.tsx index eb4aec2ff8..17b220b4e0 100644 --- a/webapp/channels/src/components/channel_header/channel_header_title_favorite.tsx +++ b/webapp/channels/src/components/channel_header/channel_header_title_favorite.tsx @@ -2,17 +2,14 @@ // See LICENSE.txt for license information. import classNames from 'classnames'; -import React, {memo, useRef, useCallback} from 'react'; +import React, {memo, useCallback} from 'react'; import {FormattedMessage, useIntl} from 'react-intl'; import {useSelector, useDispatch} from 'react-redux'; import {favoriteChannel, unfavoriteChannel} from 'mattermost-redux/actions/channels'; import {getCurrentChannel, isCurrentChannelFavorite} from 'mattermost-redux/selectors/entities/channels'; -import OverlayTrigger from 'components/overlay_trigger'; -import Tooltip from 'components/tooltip'; - -import {Constants} from 'utils/constants'; +import WithTooltip from 'components/with_tooltip'; const ChannelHeaderTitleFavorite = () => { const intl = useIntl(); @@ -20,7 +17,6 @@ const ChannelHeaderTitleFavorite = () => { const isFavorite = useSelector(isCurrentChannelFavorite); const channel = useSelector(getCurrentChannel); const channelIsArchived = (channel?.delete_at ?? 0) > 0; - const toggleFavoriteRef = useRef(null); const toggleFavoriteCallback = useCallback((e: React.MouseEvent) => { e.stopPropagation(); @@ -34,11 +30,6 @@ const ChannelHeaderTitleFavorite = () => { } }, [isFavorite, channel?.id]); - const removeTooltipLink = useCallback(() => { - // Bootstrap adds the attr dynamically, removing it to prevent a11y readout - toggleFavoriteRef.current?.removeAttribute('aria-describedby'); - }, []); - if (!channel || channelIsArchived) { return null; } @@ -49,8 +40,8 @@ const ChannelHeaderTitleFavorite = () => { } ariaLabel = ariaLabel.toLowerCase(); - const toggleFavoriteTooltip = ( - + const title = ( + <> {!isFavorite && { id='channelHeader.removeFromFavorites' defaultMessage='Remove from Favorites' />} - + ); return ( - - + ); };