react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Open zeeshanjan82 opened this issue 1 year ago • 7 comments

I have experienced an issue with 'react-select' library when displaying translated options inside the dropdown. I am getting the attached screenshot error

Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

image

The error occurs randomly on several pages and it is hard to reproduce this error but it seems to be coming from the react-select library when it is configured to use the translation options. Example:

  const dateRangeList = [
    { label: getText('retailtransactions:DATERANGE_TODAY'), value: TODAY },
    { label: getText('retailtransactions:DATERANGE_YESTERDAY'), value: YESTERDAY },
    { label: getText('retailtransactions:DATERANGE_THIS_WEEK'), value: THIS_WEEK },
    { label: getText('retailtransactions:DATERANGE_LAST_WEEK'), value: LAST_WEEK },
    { label: getText('retailtransactions:DATERANGE_THIS_MONTH'), value: THIS_MONTH },
    { label: getText('retailtransactions:DATERANGE_LAST_MONTH'), value: LAST_MONTH },
  ];

I am configuring the above code to populate the react-select options and then I am calling the following code in jsx file

<Select name="dateRange" className="date-range rdt mt-30" placeholder={getText('retailtransactions:DATERANGE')} value={state.dateRange ? dateRangeList.filter((date) => date.value === state.dateRange)[0] : ''} onChange={(val) => onDateRangeChange(val)} options={dateRangeList} />

Here I am using an helper function getText which pull the value from the react-i18next translation file

import { ENGLISH_LANG } from 'configs/constants';
import i18n from '../../i18n';

export const getText = (label) => {
    if (i18n.t &&  (!i18n.t(label) || i18n.t(label)?.length === 0)) {
        return i18n.t(label, { lng: ENGLISH_LANG });
    } else if(i18n.t) {
        return i18n.t(label);
    } else {
        return label;
    }
};

zeeshanjan82 avatar Nov 23 '23 00:11 zeeshanjan82

I have this same issue when interacting with react-select component in Microsoft Edge after translating the website

Snaxai avatar Jan 25 '24 13:01 Snaxai

I have the same issue after translating on Edge also

dukemai avatar Apr 23 '24 15:04 dukemai

I also have the same issue, seems to only happen on Edge (v124)

NotFoundError Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

haukurmar avatar Apr 24 '24 07:04 haukurmar

Same issue, it happens when using Edge (Chromium) and translating the page. It does not happen immediately after translating, you have to open the menu and then close it, then it crashes. I have not been able to pinpoint what node is causing this to break.

kaoz70 avatar Apr 26 '24 13:04 kaoz70

We have the same issue using translation in Edge 124, crashes on span's with ids aria-focused, aria-results, aria-guidance. As a workaround – add prop ariaLiveMessages with empty messages.

const emptyAriaLiveMessages = {
    guidance: () => '',
    onChange: () => '',
    onFilter: () => '',
    onFocus: () => ''
};

...

<Select
    ariaLiveMessages={emptyAriaLiveMessages}
    ...
/>

iohunter avatar May 20 '24 14:05 iohunter

Also facing this issue with Edge browser version 125. Tested @iohunter workaround and can confirm that works to stop the issue.

frenchki avatar May 23 '24 06:05 frenchki

Thank you so much @iohunter that worked! How did you figure out that that fixed it?

CharlesErrington avatar Aug 12 '24 11:08 CharlesErrington