@daoyi/nmtl-ui 2.0.1-beta.122 → 2.0.1-beta.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,10 +28,10 @@ var ForwardLink = function ForwardLink(_ref) {
|
|
|
28
28
|
var _useMemo = useMemo(function () {
|
|
29
29
|
var _rest$pathname;
|
|
30
30
|
if (disabled) return {};
|
|
31
|
-
/*
|
|
32
|
-
* 若將 search 寫在 pathname 中,意即 pathname=/asd?zxc=qwe
|
|
33
|
-
* 會導致換頁時 React route dom 無法匹配 => 空白畫面
|
|
34
|
-
* 若真有此情況發生 需把 search 提領出來
|
|
31
|
+
/*
|
|
32
|
+
* 若將 search 寫在 pathname 中,意即 pathname=/asd?zxc=qwe
|
|
33
|
+
* 會導致換頁時 React route dom 無法匹配 => 空白畫面
|
|
34
|
+
* 若真有此情況發生 需把 search 提領出來
|
|
35
35
|
*/
|
|
36
36
|
var foundIndex = (_rest$pathname = rest.pathname) === null || _rest$pathname === void 0 ? void 0 : _rest$pathname.indexOf('?');
|
|
37
37
|
if (foundIndex > -1) return {
|
|
@@ -54,20 +54,26 @@ var ForwardLink = function ForwardLink(_ref) {
|
|
|
54
54
|
var newWindowLabel = target === '_blank' && (typeof children === 'string' || title) ? "".concat(typeof children === 'string' ? children : title).concat(getIntl().formatMessage({
|
|
55
55
|
id: 'aria.newWindow'
|
|
56
56
|
})) : undefined;
|
|
57
|
-
/* R24:aria-label 已含 title 全文時不再輸出 title 屬性——NVDA 會把 title 屬性當
|
|
57
|
+
/* R24:aria-label 已含 title 全文時不再輸出 title 屬性——NVDA 會把 title 屬性當
|
|
58
58
|
description 接在 aria-label 之後再唸一次,造成「書名 ×2」(abo 首頁推薦卡實測) */
|
|
59
59
|
var linkTitle = newWindowLabel ? undefined : domTitle;
|
|
60
|
+
|
|
61
|
+
/* 沒有可及名稱的連結對所有使用者都無用,且會被判 Freego HM1240401C
|
|
62
|
+
(實測 ocean books?id=ART469770:某筆資料人名為空 → <a> 內容全空)。
|
|
63
|
+
children 為空字串/空值且無 title 時,改以非互動元素呈現。 */
|
|
64
|
+
var namelessChildren = children === undefined || children === null || children === false || typeof children === 'string' && !children.trim();
|
|
65
|
+
var nameless = namelessChildren && !title;
|
|
60
66
|
var linkComponent = /*#__PURE__*/React__default.createElement("div", {
|
|
61
67
|
className: className
|
|
62
68
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
63
69
|
className: "forwardLink"
|
|
64
|
-
}, disabled ? /*#__PURE__*/React__default.createElement("div", {
|
|
70
|
+
}, disabled || nameless ? /*#__PURE__*/React__default.createElement("div", {
|
|
65
71
|
title: domTitle,
|
|
66
72
|
className: classNames('forwardLink__link--disabled', linkClassName)
|
|
67
73
|
}, children) :
|
|
68
74
|
/*#__PURE__*/
|
|
69
|
-
/* linkClassName 直接掛在可聚焦的 <a> 上:消費端的 ellipsis/overflow 樣式若掛在
|
|
70
|
-
外層 className(包裹 div),會裁掉 <a> 的焦點框(WCAG 2.4.7 走查實測)——
|
|
75
|
+
/* linkClassName 直接掛在可聚焦的 <a> 上:消費端的 ellipsis/overflow 樣式若掛在
|
|
76
|
+
外層 className(包裹 div),會裁掉 <a> 的焦點框(WCAG 2.4.7 走查實測)——
|
|
71
77
|
此類樣式應改傳 linkClassName */
|
|
72
78
|
React__default.createElement(Link, {
|
|
73
79
|
className: classNames('forwardLink__link', linkClassName),
|
|
@@ -2,7 +2,7 @@ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
|
2
2
|
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { c as classNames } from './index-b76a85f4.js';
|
|
5
|
-
import { F as ForwardLink } from './ForwardLink-
|
|
5
|
+
import { F as ForwardLink } from './ForwardLink-9f22205c.js';
|
|
6
6
|
import { getIntl } from './globalConfig';
|
|
7
7
|
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
8
8
|
import './index-b47819f3.js';
|
package/package.json
CHANGED