简体   繁体   English

输入清除按钮在Microsoft Edge中不起作用

[英]Input clear button does not work in Microsoft Edge

I am using reactjs, redux form and semantic UI react to build an application. 我正在使用reactjs,redux表单和语义UI来构建应用程序。 The following codes behavior differently in IE11, Edge, and Chrome. 以下代码在IE11,Edge和Chrome中的行为不同。 I have included polyfill in the index.js 我已经将polyfill包含在index.js中

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

In IE11, the input will be rendered with a clear button, and it works well. 在IE11中,输入将使用清除按钮呈现,并且效果很好。

In Chrome, the input does not have a clear button. 在Chrome中,输入没有清除按钮。

In edge, the input has a clear button, but it cannot clear the input after clicked. 在边缘,输入具有清除按钮,但是单击后无法清除输入。

I have created a demo project for this issue: https://codesandbox.io/s/redux-form-field-level-validation-zedcu?fontsize=14 我已经为此问题创建了一个演示项目: https : //codesandbox.io/s/redux-form-field-level-validation-zedcu?fontsize=14

Can anyone tell me why it does not work in edge? 谁能告诉我为什么它不能在边缘工作? Help is appreciated. 感谢帮助。

import React from "react";
import { Field } from "redux-form";
import { Form } from "semantic-ui-react";
import RenderFieldInput from "../../formElements/Input";
import RenderFieldSelect from "../../formElements/Select";
import { YES_NO } from "../../formElements/SelectOptions";
import { required, email } from "redux-form-validators";
import { createNumberMask, createTextMask } from 'redux-form-input-masks';

const currencyMask = createNumberMask({
  prefix: '$ ',
  suffix: '',
  decimalPlaces: 2,
  locale: 'en-US',
})

const BorrAttributes = () => {
  return (
    <div>
      <Form.Group widths="equal">
        <Field
          name="email"
          component={RenderFieldInput}
          label="Email"
          required="Y"
          validate={[required(), email()]}
        />
        <Field
          name="secondEmail"
          component={RenderFieldInput}
          label="Second Email"
          validate={[email()]}
        />
      </Form.Group>
    </div>
  );
};

export default BorrAttributes;

import React from "react";
import { Form, Popup } from "semantic-ui-react";
import Tooltip from "./Tooltip";

const RenderFieldInput = ({
  input,
  label,
  placeholder,
  required,
  meta: { touched, error, warning }
}) => (
  <Popup
    trigger={
      <Form.Input
        {...input}
        label={label}
        placeholder={placeholder}
        error={error ? true : null}
        required={required === "Y" ? true : null}
        fluid
      />
    }
  >
    <Tooltip touched={touched} error={error} warning={warning} />
  </Popup>
);

export default RenderFieldInput;

The issue is related to the "RenderFieldInput" component, perhaps it is related to the Popup, I think you could feedback this issue to Semantic-UI-React forum . 该问题与“ RenderFieldInput”组件有关,也许与弹出窗口有关,我认为您可以将此问题反馈给Semantic-UI-React论坛

As a temporary workaround, you could try to remove this component. 作为临时的解决方法,您可以尝试删除此组件。 Code as below: 代码如下:

const FieldLevelValidationForm = props => {
  const { handleSubmit } = props;
  return (
    <form onSubmit={handleSubmit}>
      <Field
        name="username"
        type="text"
        component="input"
        validate={[required()]}
        label="Username"
      />
    </form>
  );
};

More details about semantic UI react Popup, you could check this link 有关语义UI react Popup的更多详细信息,可以检查此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM