From 850e713e7f570381be2f0cfbb622a1945f0fcfa7 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 10 Nov 2016 11:35:12 +0800 Subject: [PATCH] Improve text overflow for MenuItem and AnchorLink, close #3712 --- components/anchor/AnchorLink.tsx | 1 + components/anchor/style/index.less | 3 +++ components/menu/style/index.less | 2 ++ 3 files changed, 6 insertions(+) diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 74aae24947..0a65380ed5 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -82,6 +82,7 @@ export default class AnchorLink extends React.Component { className={`${prefixCls}-link-title`} onClick={this.scrollTo} href={href} + title={typeof title === 'string' ? title : ''} > {title} diff --git a/components/anchor/style/index.less b/components/anchor/style/index.less index 2c18dfc62b..2737b63278 100644 --- a/components/anchor/style/index.less +++ b/components/anchor/style/index.less @@ -54,6 +54,9 @@ position: relative; transition: all .3s; color: @text-color; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } &-active > &-title { diff --git a/components/menu/style/index.less b/components/menu/style/index.less index 6b4564c95a..82651ccd4e 100644 --- a/components/menu/style/index.less +++ b/components/menu/style/index.less @@ -278,6 +278,8 @@ font-size: @font-size-base; line-height: 42px; height: 42px; + overflow: hidden; + text-overflow: ellipsis; } }