Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Input]there is no match between character count and maxLength limited in 'multiple' mode. #670

Closed
hipoyang opened this issue May 16, 2019 · 2 comments
Labels
🐞 Bug Something isn't working

Comments

@hipoyang
Copy link

hipoyang commented May 16, 2019

Reproduction link
https://riddle.alibaba-inc.com/riddles/dda87ac8

tips: Found it easily using Safari.

@fusion-design-bot fusion-design-bot added the invalid This doesn't seem right label May 16, 2019
@fusion-design-bot
Copy link

hi @hipoyang,非常感谢您的反馈,但是由于您没有使用 创建 issue 页面提交, 将直接被关闭, 谢谢!

@hipoyang hipoyang changed the title [Input]there is no match between character count and input limited in 'multiple' mode. [Input]there is no match between character count and maxLength limited in 'multiple' mode. May 16, 2019
@bindoon bindoon reopened this May 16, 2019
@bindoon bindoon added 🐞 Bug Something isn't working and removed invalid This doesn't seem right labels May 16, 2019
@bindoon
Copy link
Member

bindoon commented Jun 14, 2019

we have fix problem in @alifd/[email protected] version.

in 0.x version you can use getValueLength to recompute the length

// safari in mac
const isMacSafari =
    navigator && navigator.userAgent
        ? navigator.userAgent.match(/^((?!chrome|android|windows).)*safari/i)
        : false;
const maxLength = 100;

function  getValueLength(value) {
       let strLen = value.length;

        if (isMacSafari) {
            strLen = strLen + value.split('\n').length - 1;
            if (strLen > maxLength) {
                strLen = maxLength;
            }
        }

        return strLen;
    }

<Input mode="multiple" getValueLength={getValueLength} />

@bindoon bindoon closed this as completed Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants