How to have content pop out of iframe? - html

Say I have a menu which is initially 200px by 100px. I need to include it in an iframe but the problem is it is a dropdown menu and when it opens the menu gets cut of since it is inside the frame. Is there a way to have it drop out of the frame?

If both the parent page and the page within your iframe are coming from the same domain, you can communicate between them via JS:
Possible Ways to Communicate Between iFrame and Parent Page across domains
The solution would be to, upon hover, send JS to the parent page and have the parent page then render the menu on top of the iframe.
That said, having to use a menu within an iframe that then pops out of the iframe seems to be not a technical problem as much as it is a visual design and layout problem.

No there is not. You will need to use a different approach, such as downloading the content of the frame on the server and inlining it in the parent page instead. Another possibility would be to float the parent page's content over the iframe and make the iframe larger.

Related

ARIA Live Regions for single page applications

I am new to accessibility of web pages. I have an application where the content of the body changes based on the header link clicks in an ajax call without page refresh. So the HTML content inside the body gets updated for each link click with different page content (table + button + information text).
My requirement here is the screen reader should announce the information text each time when the page gets loaded. Here the container is body (or an immediate div inside body) for all pages. So I have made it aria-live="polite", but every time page loads it is announcing the whole page content but I want to make it announce only the information text. Other elements of the page should be announced on focus/visit. I hope I can apply aria-live="off" for all other elements but I'm looking for any ideal solution for this. I cannot change the layout of the application.
Can some one help me on this. Thanks in advance.
SPA pattern best practices
You are essentially following a Single Page Application pattern. As such the method recommended for handling navigation is actually quite straight forward with two steps.
tell a user that navigation is about to occur (before navigation)
let a user know that loading is complete (after navigation).
before navigation (link click)
You need to signal to a user that a page is loading if you are using a SPA pattern (and therefore interrupting normal navigation). e.g. I click your link, you need to let me know that an action is being performed (loading.....) as you intercept the normal browser behaviour with e.preventDefault() or equivalent.
The simplest way is to use aria-live=assertive on a region that explains the page is loading. You can Google how to implement that correctly but essentially you would update the content of a hidden div (<div aria-live="assertive" class="visually-hidden">loading</div> with some loading message the second a link is clicked.
This should be done before any AJAX calls are made.
after navigation (new content loaded)
When the new page loads you need to manage focus.
The best way to do this is to add a level 1 heading (<h1>) to each page that has tabindex="-1". By using tabindex="-1" it means that the heading won't be focusable by anything other than your JavaScript so won't interfere with the normal document flow.
Once the page loads and the content has been populated fully the last action you perform in your JavaScript navigation function is to place the focus onto this heading.
This has two benefits:
it lets the user know where they are now
it also lets them know when the page load is complete (as AJAX navigation doesn't announce when the page is loaded in most screen readers).
At this point you may also want to clear the <div aria-live="assertive"> contents so that it is ready for further navigation.
Have you tried to wrap the "live zones" - where updates happen in div with aria-live="polite". Then screen reader will announces only these zones on updates.Don't wrap whole page or div in aria-live="polite".
<div aria-live="polite">
<p id="errorText">Announced on update</p>
</div>
<div>
other page sections..
</div>

Multiple <a target=" "> attributes?

I have a page with a Google Tour in an iframe. I've set iframe's name as "vtour". The iframe is inside a div whose ID I've set to "tour".
Below the iframe I have some links that jump to certain locations in the Google Tour (within the iframe). This works fine, except that now only the bottom bit of the iframe is on screen since I've scrolled down the page somewhat in order to access the links below it. So I would like these links to jump me higher up on the page by targeting the div's ID so the full iframe is in view.
Is it possible to have a link target both the content inside an iframe and the iframe's location on the page using the div ID? Or, since my iframe is near the top of the page, the target attribute "_top" could also work.
No, the target attribute can only point to one target browsing context at a time. You'll probably need to use a JavaScript click handler to scroll the page programmatically as the link navigates the iframe.

Redirecting to a part of a page, specifically top of the page

I have this page and i am using an Iframe.
I do my actions in my iframe and it automatically resize, but when the iframe is long (vertically),
and i click on a button that would redirect the page to the next, my parent page is still in the bottom part, and the iframe pgae is at the top.
how would i redirect the parent page to scroll up once location:PAGE.php is triggered, location:PAGE.php is the one inside the iframe.
I hope i asked it properly. i tried a url using #IDofDIV but it only redirects inside of the iframe, i need to redirect outside of the frame. so it goes on top again.
thank you.
Try to add onload="parent.scrollTo(0,0);" on your PAGE.php.

Iframe always on top in IE

I have some page content in an iframe. I also have a drop-down menu that contains some user options. In IE (9), when I open the drop-down the menu, it appears behind the iframe. In every other browser, the behaviour as is correct (the menu appears on top of the iframe).
I have tried applying various z-index properties to these elements without success. Their common parent element is just a <body> tag.
How can I ensure that the drop-down always appears on top of the iframe in IE?
So one possible solution is to put an empty iframe on the screen, directly beneath the drop-down menu. You can use the z-index in this context to ensure that menu appears overtop of your empty iframe, and the whole thing will appear on top of the original iframe.
Not a very nice solution, but it works. I'm open to any suggestions on how to do this in a nicer way.

Seamless FRAME/IFRAMEs (with reasonable scrollbars)?

Summary:
I'd like to display a shopping cart from another domain underneath my fixed content in my page - and have the scrollbars come out properly.
Details:
I need to display a shopping cart from a vendor within a page on "my" site with "my" header on top. (Eventually the shopping will all be in a subdomain but not now, sigh.) The header is a fixed height. The shopping cart pages vary in height as you navigate within that frame.
I've tried frames and iframes and had cross-browser issues with the iframes. I'm only testing four configurations, Windows/IE, Windows/Firefox, Mac/Safari and Mac/Firefox.
Right now I am using a frameset with two frames, one containing my fixed-height header page, the other containing the external page. This does work - the one issue is that when a scrollbar appears it (of course) only appears on the bottom frame.
This will do and the client isn't very sophisticated but it bugs me.
If I use IFRAMES, I find I need to sprinkle height: 100% and overflow-y: auto in various places - and yet I still cannot avoid either one of two unacceptable issues that appear in at least one of the browser/OS combinations...
The combined content is larger than the window, but no scrollbar appears.
An inner scrollbar and an outer scrollbar both appear.
Any hints appreciated!
EDIT:
Thanks for the work - but I don't think I conveyed the issue correctly.
I'm not using frames for layout - I wish simply to make a page framing something on another site (that hosts the shopping cart and whose URL should not be exposed).
Frames "work" - BUT having an interior scrollbar on the second frame and no scrollbar on the whole page is definitely wrong behavior. My client won't know this but it'll look amateurish to people seeing the page.
I don't see quite how a server-side include or CSS would do it and I know both fairly well. If I used the server side include, how would links internal to the shopping cart work? I'd leave my site, correct?
Summary: A shopping cart hosted on another site, embedded on my content page.
Don't use frames, if the user does command + click then the product will open in new window and your frame will disappear.
One feasible solution I see here is with Javascript:
Load the page via $.ajax
redirect all clicks so that it loads in ajax window by
$('iframe a').on('click',function(){
// load the product via AJAX
});
make sure height of Div is not fixed so that it expands automatically and scrollbars are there only on window.
This is best way I could think of keeping the integration seamless while hiding the url