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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read style type of hyperlinks #296

Open
d-e-v-esh opened this issue Mar 11, 2021 · 3 comments
Open

Cannot read style type of hyperlinks #296

d-e-v-esh opened this issue Mar 11, 2021 · 3 comments

Comments

@d-e-v-esh
Copy link
Contributor

Bug Report 馃悰

We get this error while trying to calculate the style of hyperlinks:

chrome_fzY8aTnY6q

As you can see in this line that we need the value editor.selection for currentStyleCalculated which will tell us the type of the current block. It works absolutely great for every single type of text except for hyperlinks.

This issue did not surface beforehand because it was inside a conditional statement which only allowed this calculation to take place if (editor && editor.selection) outputted a positive result, as well as the change in style-type was not 'real-time' so it was difficult to catch, see #283 for more details. That is why the style type got defaulted to the string 'Style' whenever this happened.

What appears here from some basic testing (logging !!editor.selection on console) is that calculating the style of hyperlinks itself is not creating the issue. The error comes up as soon as the pop-up appears.


3ytsK9qOzr

You can see here that the value is truthy at first but when the pop-up appears, it becomes falsy(here: null).

Expected Behavior

We should be able to calculate the style type of link. editor.selection should not be undefined when the pop-up menu appears. Also, we should be able to calculate the style of the block where the link is whether it is any of the headings or the paragraph.

Possible Solution

Seems like the problem might be being caused by how the pop-up is being rendered.

Steps to Reproduce

  1. Go to any line with a link and click on the link.
  2. You would get the above-mentioned error in the console.

Context (Environment)

Desktop

  • OS: Windows 10
  • Browser: Chrome
  • Version 88.0.4324.182 (Official Build) (64-bit)

Detailed Description

Possible Implementation

@Arvind644
Copy link

I want to work on this issue. Pls assign me this task

@irmerk
Copy link
Member

irmerk commented Mar 23, 2021

@Arvind644 I think this issue needs some more investigation to see what the problem is, if any. Please look in to it and share your findings and proposed solution here.

@TC5022
Copy link
Contributor

TC5022 commented Mar 6, 2022

@irmerk the problem here isn't with the link but with the modal pop-up. This can be tested by commenting the code where we show the link modal and then clicking on the link.
I think this is happening because we don't shift the focus to the modal anywhere in the code. For example, when we add an image to the editor, we shift the focus of the editor by using the useFocused hook. So, I plan on solving this issue by finding a way to get the editor to focus on the link modal when it is rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants