KennethSundqvist / key-jump-browser-extension

Easier keyboard navigation. No mouse needed to click on links and stuff.
67 stars 14 forks source link

Not all links found on this AWS page #56

Closed jeshan closed 4 years ago

jeshan commented 4 years ago

It usually works well elsewhere but take a look at this: image

We have many shortcuts for many links but those on the left are not found. Example xpath for one that wasn't found:

#ddbv2-shortcut-tables-link/html/body/div[1]/div[2]/div/div/div[2]/div/div[2]/div/div[4]/div/div/div/ul[3]/li[1]/a
KennethSundqvist commented 4 years ago

Hi @jeshan,

By looking at the xpath it seems like those links are inside an iframe. Can you confirm if that's true?

Unfortunately this extension doesn't support finding links inside iframes.

jeshan commented 4 years ago

No, it's not part of the iframe.

There's an iframe on the page that looks like this but I don't know if it's relevant here:

<iframe src="javascript:&quot;&quot;" id="dynamodb" tabindex="-1" style="position: absolute; width: 0px; height: 0px; border: none; left: -1000px; top: -1000px;"></iframe>

I'm trying to copy the full xpath again but strangely, Chrome is showing me it without the element ID (not sure what I did the first time):

/html/body/div[1]/div[2]/div/div/div[2]/div/div[2]/div/div[4]/div/div/div/ul[3]/li[1]/a

Maybe the extension is reading the DOM too soon and my links appear later dynamically. What do you think?

KennethSundqvist commented 4 years ago

The extension reads the links each time you activate the hints, scroll the page, or resize the window, so they don't have to bee there when the page loads.

Try activating the extension and then scroll the page. The hints should update for the other links, see if they now also updates for these ones it couldn't find.

Does those links have href attributes? Chould you copy the HTML of one of the links, please?

jeshan commented 4 years ago

Your guess was right, they indeed don't have href :unamused:

Here are some examples:

<a style="cursor:pointer; padding:0">my-table</a>
<a class="gwt-Anchor" id="ddbv2-shortcut-tables-link">Tables</a>
jeshan commented 4 years ago

Is it due to the a[href] here?

https://github.com/KennethSundqvist/key-jump-chrome-extension/blob/3580a2688ccd8e0cbe22b8b6c3782ffb518a815b/src/content.js#L353-L355

Is there any downside of changing it to just a?

KennethSundqvist commented 4 years ago

That's correct.

Yes, the downside is that all the a elements used only for fragment links (jump to a position in a page) are included and sometimes mess up the hint numbering or it looks like they can be clicked when they can't.

I'll add .gwt-Anchor to the list of elements to find, since it seems to be part of a framework: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/Anchor.html

I can't do anything about the other link, my-table. Sorry.

jeshan commented 4 years ago

Understood, that's what happen when people don't follow standard semantics (e.g href) :unamused:

KennethSundqvist commented 4 years ago

I've released a new version (5.1.0) which includes support for .gwt-Anchor links. Hopefully that has improved things a bit at least.

jeshan commented 4 years ago

Understood; looks reasonable now:

image

jeshan commented 4 years ago

@KennethSundqvist I think you should reopen this. I'm seeing another page like this: image

The missing links are all a[href] e.g:

<a class="awsui-button awsui-button-variant-primary awsui-hover-child-icons" override-focus="" role="button" href="javascript:void(0)"><span awsui-button-region="text">Launch VPC Wizard</span></a>
<a class="awsui-button awsui-button-variant-normal awsui-hover-child-icons" override-focus="" role="button" href="https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#LaunchInstanceWizard:" target="_blank"><span awsui-button-region="text">Launch EC2 Instances</span></a>
<a href="#vpcs:" target="_top">VPCs</a>
<a href="#NatGateways:" target="_top">NAT Gateways</a>

P.S You can ignore the "see all regions" one since they don't have href, e.g

<a class="block-link">
...
</a>
KennethSundqvist commented 4 years ago

@jeshan, I can't reproduce it with the HTML from your comment. The problem must be something else above that.

It's hard for me to help you with this since I can't access this site.

If you know how to debug javascript using the chrome developer tools then it would be very helpful if you could use breakpoints in the findHints() function to see if it finds the links and if it thinks they're visible.

jeshan commented 4 years ago

Thanks for bearing with me, Kenneth.

Af first glance, I'm seeing that putting a breakpoint (where hinting works) with condition el.text === "Subnets" is hit, but when I put a condition like el.text === "Launch VPC Wizard", it doesn't get hit. So, that tells me that it's not being selected in the first place. I'm hoping I can look into this further in an hour.

jeshan commented 4 years ago

I now realised that it's part of an iframe :sob: So, let's leave this issue closed.

KennethSundqvist commented 4 years ago

Thanks for helping me investigate!