Solution for issue: 4077#4412
Solution for issue: 4077#4412Vivek-Kamboj wants to merge 2 commits intoelastic:masterfrom Vivek-Kamboj:4077
Conversation
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
thompsongl
left a comment
There was a problem hiding this comment.
Hey @Vivek-Kamboj, thanks for the PR!
Although these changes do result in the copy button being shown, it does not result in the required functionality. Mainly, clicking the copy button will not copy the actual contents of the code block.
What we need is to find the correct lifecycle event coordination that will allow for textToCopy to equal the code block contents when the code block is visible.
My initial guess is that there needs to be an extra bit of state, or that lifecycle events related to the portal need refactored.
|
Hi @thompsongl, Actually, I have made some changes in my local but I don't know how should I test this library for this issue on local or on the sandbox. |
|
It should be pretty straightforward to run this locally. |
|
As written in the comment that So I propose using Copy icon is visible and is working! @thompsongl Is it a correct solution? |
Unfortunately this would change the existing behavior of EuiInnerText and all components that rely on it. We're looking for a solution scoped to EuiCodeBlock as it is the only component adversely impacted when used with EuiAccordion. |
|
Hi @Vivek-Kamboj , are you still working on this or would you like us to finish it up? |
|
@cchaos, I don't understand the solution for this issue. So, I am unable to fix this issue. |
|
Thanks for the attempt @Vivek-Kamboj. Feel free to grab any other I'm actually just going to close the PR since the solution isn't clear. |
Summary
Hi,
I have recreated this issue #4077 and I discovered that it is not present in HTML as shown below:
Before the expand button clicked:

After the expand button clicked:

In my opinion, the error causing code is:

Here, in my opinion, "textToCopy" is undefined when it renders which is creating all these issues. And when we expand it, the component re-renders and the copy button got displayed.
So I am thinking of removing "textToCopy" from the if statement.
My Changes:

Checklist