How to add a "Skip to main content" link that only shows to screen readers, using Tailwind CSS? - hyperlink

The video below describes adding a "Skip to main content" link at the top of a web page and making it visible only by users with screen readers, using plain CSS.
The idea is to improve accessibility by allowing screen readers a way to bypass all the navigation, etc. and get to the main content
How can this be done with Tailwind CSS?
https://www.youtube.com/watch?v=VUR0I5mqq7I

Tailwind CSS let you designate elements as on visible to screen readers via "sr-only"
Code example (just inside the tag):
Skip to main content
And then add <main id="main-content"> where the main content begins on that page.
And lastly, add the closing </main> tag right after the page's main content ends.
Link to TailwindCSS's screen reader only documentation

Related

PDF inside iframe no back button when full screen

I'm developing an ionic app in iOS, I placed the pdf inside an iframe just by simply doing the following:
<iframe src="https://docs.google.com/gview?embedded=true&url=http://example.com/resources/myfile.pdf" mozallowfullscreen marginwidth="2" marginheight="2" width="90%" scrolling="auto"></iframe>
I didn't used cordovaInAppBrowser because I ran a lot of problem like after clicking the button the InAppBrowser doesn't open unless I don't minimize the app. So I just used iframe as the workaround. But the problem now is that, after the pdf being loaded, and the user clicks on the full screen of pdf, there's no back button. Is there a way I can remove the full screen button from the pdf or add a back button on full screen mode of pdf? I tried removing the mozallowfullscreen but doesn't work since it's for the iframe not for the pdf.
P.S.
I tried accessing the div inside the iframe that holds the button for full screen, but no good, it doesn't get the div, it's probably because I'm violating the Same Origin Policy.
Here's the code on how I tried to access the div:
$('#myframe').each(function(){
console.log($("div[role='toolbar']"));
});

Is it possible to link to an external htm page?

I have a review box on my website that has 10 or more reviews. Since it's all text it's getting crawled and indexed. I'd rather it didn't get crawled and I've placed the google:off and google:on idea that I discovered. However that may only work for a googlebot crawl, if at all. I was thinking if the review box could link to the text in an external htm page, like you can to a css page, then that might prevent it from being crawled and still load into the space accordingly. I don't know, is this possible?? Thanks for any response.
I have found an excellent solution on my own, and would like to share it...
I created an iframe for my review box and styled it for width, height, and border in my css. Within the iframe tag I put src="reviewstext.htm". I then created this htm page and copied and pasted all my reviews. Within the head tag of the page I put...
meta name="robots" content="noindex,nofollow"
link rel="stylesheet" href="styles.css" type="text/css"
Also, for some reason the iframe tag takes on the same background color as the body of your site. In my case it was a blue colour. I wanted my iframe to have a white background instead. The css styling didn't seem to work but styling the body tag in my reviewstext.htm file did the trick... like below.
body style="background-color: transparent;"
So, I now have a reviews box that refers to an external page. Not only does the text on that external page not get crawled, but the text is not on my homepage either for crawlers to see. With this change my keyword ratios are back in line and not obscured by all the review text... :o)

external panel in jquery mobile 1.4 causes display bug

I thought my external panels (jQM 1.4) were working great, until I added more content to them, and now, I can see the external panel underneath my app's home page.
If they are short, it's fine, but once they reach a certain height, you can scroll down on the home (first) page and see the panel's contents.
The new docs aren't much help :/
I've tried a lot of variations... but here's a basic example that will trigger it:
<div data-role="panel" id="imExternal" data-theme="a">
<div style="height: 1200px; background: #000;">
<p>this is the panel, code is tight and outside of any containing page divs.</p>
</div>
</div>
*update: I'm specifically seeing it in my app with a popup open, and then clicking on an input field to show the Android keyboard. It seems to resize the page, which shows content from another page (external panel) underneath it.
You should enhance External widgets manually, as they don't get enhanced when page is created.
$(function () {
$("[data-role=panel]").panel();
});
Also, elements / widgets inside External panel should be enhanced as well.
$(function () {
$("[data-role=panel]").panel().enhanceWithin();
});
Actually... DON'T use popups in external panels. Ultimately, that was the root cause of this.
I solved this by setting the css height of the page in question to the window height, which prevented the underlying panel from showing below it.
$('#page').css('height', $(window).height());

Using jQuery selectable within an iFrame

Im developing an HTML generator using jQuery through a drag & drop interface. Currently the user drags "block" elements onto an invisible div overlaying an iFrame (so that it appears to be dropping onto the iframe). When the element is dropped on this invisible div, the corresponding HTML is appended to the iFrame body.
Next, i want to give the user the ability to select an element in the iFrame, and change the properties of the selected element.
I have appended CSS imports and the jQuery/jQueryUI scripts into the iFrame head.
The issue I am facing is when the appended iFrame element is clicked, the jQuery select lasso only appears when the mouse leaves the iFrame, and on it appears outside of the iframe.
The reason I am using the iFrame is so when the code is "generated" for the user, i can just append the iFrame body content to a dialog box.
Has anyone faced issues with the iFrame and jQuery before? and is there any documentation/javaScript library that can assist me in this process?
Thanks!
Rory
The "fix" around this issue is convoluted, but works in my situation.
I created a click event on each added element in the iframe like so:
$('iframe').contents().find('.elem'+blockVal).on('click', function(){
$('iframe').contents().find('.selected').removeClass('selected');
$(this).addClass('selected');
//alert('you have selected the block with class element'+ blockVal);
});
blockVal is a variable passed in from the function that appends the html to the iframe. The above function just adds a click listener to each element appended to the iframe. When any of the elements are clicked, they are given a class of 'selected', and any other element that already has that class, loses it.
Im sorry if that doesn't make any sense.
My advice to anyone doing something similar: Don't use an iframe.

jQuery UI dialog box appears at top of page while page is loading

I have a jQuery dialog box on my website. I give a div on the page the "dialog" id it's contents become the contents of the dialog box. However, when the page is loading, this div appears at the top of the page and looks bad. Does anyone know how to deal with this?
Just hide your div via your CSS file:
#dialog {display: none}
This will not affect its actual display when the dialog is opened.
I tested to be sure, and this method worked with jQuery UI 1.7.2
Assuming that the dialog is changing the 'display' style [eg using .show() and .hide()] then all jQueryUI is doing is setting the display style. thus, you can set the div with the display:none by default, and that way it won't show when you load.

Resources