Make image link to a page using Logo Attributes in Oracle APEX - html

I'm currently running Oracle Applications Express on my corporate network (for an internal project) and I am simply trying to make the Logo that I have used to link to the home page. The logo appears on every page and when a user clicks on the logo, it navigates them back to the home page.
I've tried all sorts of different strings, like
$('a[href*="HOME"]')
<a href="/">
<a href="f?p=300">
etc. etc.
My application is lying on Application 300, since this is the development version. The home URL is: f?p=300:1:17112837468263
Is what I am asking actually possible to do?
Thanks

When you define the logo on the application attributes, it will be shown on pages because it has been included in the page template(s).
For example, on my apex (4.2) instance I'm using "Theme 24 - Cloudy". In the "One Level Tabs - No Sidebar" template the logo substitution string #LOGO# is used in the "Definition > Body" section:
<header id="uHeader">
#REGION_POSITION_07#
<hgroup>
#LOGO#
<div class="uAPEXNavBar">
<ul>
#NAVIGATION_BAR#
</ul>
</div>
#REGION_POSITION_08#
</hgroup>
<nav>
<ul>
#TAB_CELLS#
</ul>
</nav>
#REGION_POSITION_04#
</header>
#REGION_POSITION_01#
#SUCCESS_MESSAGE##NOTIFICATION_MESSAGE##GLOBAL_NOTIFICATION#
<div id="uOneCol">
#REGION_POSITION_02#
#BOX_BODY#
#REGION_POSITION_03#
</div>
header > hgroup > a if you didn't spot it.
As you can see, the logo here is already wrapped in an anchor which refers to the homelink #HOME_LINK#. This homelink is something you can define aswell by the way. You can set the homelink through "Application Properties > User interfaces" and selecting the interface you use, for example "Desktop". "Home URL" is a field there.
So what you should do is:
Check the theme you are using
Check the default page template (and any other used page templates of
course)
See where the #LOGO# substitution string is used and how it is put
out
If it isn't in an anchor yet you can do that. If you aren't on apex 4.2 (You didn't specify) I'm not sure if you can use #HOME_LINK#, I can't recall. You could always use string substitution syntax however (and you should, especially when constructing these types of links): href='f?p=&APP_ID.:1:&SESSION.'

Related

Is it accessible to style button tags to look like links? [duplicate]

This question already has answers here:
Anchor or Button in React SPA?
(3 answers)
Closed 9 months ago.
I see a lot of discussion on the internet about <a> tags that look like buttons, and rules that all links must obey. However, I am confused about <button> tags that are styled to look like links.
I am creating a single-page-app and my navigation component is responsible for rendering / hiding different sections of the website. Only one section would be visible at a time, so I'm treating each section as if it was a unique page with its own route.
My navigation controls are buttons, instead of links. I did this because there is nothing valid that I'm aware of, which I can put inside the hrefs (given that the hidden content is not present in the DOM).
I read on the internet that buttons must have styling to identify the priority of the button, for accessibility reasons. Ideally, I want the buttons to look like links since they behave similarly to links (although not identical).
Are there any accessibility concerns with styling buttons to look like links? Would it make more sense to style these buttons as buttons? If they should look like buttons then what should be the priority? Does it make more sense just to hide the hidden "pages" with css, so that I can turn the buttons into <a> tags and add an href?
Here is the typical markup for single page apps
<div>
<nav>
<ul>
<li>
<button data-name="Skills">Skills</button>
</li>
<li>
<button data-name="Projects">Projects</button>
</li>
<li>
<button data-name="History">History</button>
</li>
<li>
<button data-name="Employment">Employment</button>
</li>
<li>
<button data-name="Contact">Contact</button>
</li>
</ul>
</nav>
<div id="content-panel">
Home
</div>
</div>
The part at the bottom div#content-panel represents the Home page. It will be replaced with the other pages using JavaScript, which will contain the main content of the website.
For those who stumble across this, please don't use <a> without an href, it results in an element that is not longer focusable with the keyboard.
The following fiddle shows this. Try using Tab to focus the links.
You could obviously add tabindex="0" to add them back to the focus order, but this is an anti-pattern and if you ever find yourself doing this it is an indication that you have made a mistake with your HTML.
<div>
<nav>
<ul>
<li>
<a data-name="Skills">Skills</a>
</li>
<li>
<a data-name="Projects">Projects</a>
</li>
<li>
<a data-name="History">History</a>
</li>
<li>
<a data-name="Employment">Employment</a>
</li>
<li>
<a data-name="Contact">Contact</a>
</li>
</ul>
</nav>
<div id="content-panel">
Home
</div>
</div>
If you are building a SPA in a fashion similar to that described by the OP you should still be using anchors <a> for navigation.
There are a few things you should consider:
When each section is shown you should update the URL on the site via JavaScript.
If your site also has Server Side Rendering (SSR) and can function in a limited fashion without JavaScript (recommended as JavaScript does fail more often than you think due to network errors, JS errors for certain scenarios you missed etc. etc.) then the href of the anchors should point to the correct URL.
On SPA navigation it is recommended that once the new page is loaded you programatically set focus on that pages <h1>. You can do this by adding tabindex="-1" to the <h1> (which allows it to receive focus programatically without being added to the focus order of the page) and then using header1.focus()
For an even better experience for people who use a screen reader it may also be beneficial to add an aria-live section to the page with the value of assertive that announces "loading" once a link is clicked. <div aria-live="assertive"><!--add "loading" here programatically when the link is clicked, remove it once the page has loaded--></div>
I have a reasonably long answer with a bit more detail of this technique here that explains why.
To answer the original question finally!
You can style a button to look like a link. However consistency across a site is key.
So make sure that if that is the styling you use for buttons that the majority of buttons look the same.
Also if you make a button look like a standard link then really you should make your links look different to your buttons styled as links.
This avoids confusion as a button has the expectation it will change something on the current page or submit a form, a link has the expectation of changing the page / URL / navigation.
However the advice is not quite the same for a link styled like a button. It has become acceptable that links can be styled like buttons if they are a Call To Action for example. Yet again though, consistency across a site is key for a great user experience.
As stated on MDN Navigation expects to have a links as children. So if you want to prevent any accesibility issue, I suggest you to stick to them, just remove the href attribute and add a type="button" to your a tags.
Anything that looks like something else fools the user. This applies to a link looking like a button, a link looking like plain text, an h1 looking like an h2, a ul looking like an ol, etc. When the user is fooled, the user can get confused or be misled into errors. With a link that looks like a button, for example, the user may press Space to activate it and be surprised to find that it is not activated, but instead the page is scrolled.

Page Anchors In Yesod

Normally you can specify an anchor on a page such as "index.html" with code such as:
Link Text
You can then jump to that anchor when the page is displayed by including it in the path:
http://example.com/index.html#anchor
I am developing a landing page with the Yesod Haskell framework, and would like to integrate this functionality into my landing page.
Currently I have a navigation bar with several links at the top of the page. The navbar is specified with hamlet as:
<div #navbar .collapse.navbar-collapse>
<ul .nav.navbar-nav>
<li :Just HomeR == mcurrentRoute:.active>
<a href=#{HomeR}>_{MsgHome}
Note that the href is specified with "HomeR". "HomeR" is defined in the Yesode "config/routes" file that lists all of the paths for the site.
It looks like:
/ HomeR GET
/settings SettingsR GET
Here is my problem. I can add an anchor to a section of the hamlet specification, then modify the href on the title bar to jump to that section such as:
<li :Just HomeR == mcurrentRoute:.active>
<a href=#{HomeR}#section0>_{MsgHome}
However this is annoying for several reasons. First the anchor is not checked for validity at compile time like the other paths.
Second normally the current page is highlighted on the navigation bar with the code:
<li :Just HomeR == mcurrentRoute:.active>
With this approach I can highlight for individual pages, but not individual anchors within a page.
Is there a way to insert safe anchors into the Yesod config/routes file. Or is it only possible to have a route with actual pages. This would allow jumping to sections of the page in the navbar, then highlighting the section that was clicked on. If this is not possible is there a better way to deal with page anchors in yesod?

How can I add a generic page header with site navigation to an asciidoc document?

I'm trying to build a basic documentation site using asciidoctor. One thing I am struggling with is how I can inject a standard site header (a banner with a logo and top-level navigation) into each documentation page.
I render my asciidoc directly to html from the command line. I have tried to find a way to somehow inject an extra div element and position it fixed at the top, but I can't figure out what mechanism to use for this. My early attempts involved using docinfo.html but that gets injected into the html in the <head> element, instead of the <body>.
I am aware that full-on publication systems like Jekyll allow me to configure "front matter" that can probably take care of this, but I was hoping there was a mechanism or trick using vanilla asciidoctor that can achieve this.
Ted Bergeron on the Mailing List mentioned a simple project:
Demo website created just using Asciidoctor.
Check the corresponding repo to see the files and how to create the site (just using one command).
In summary: simply create a header asciidoc file that includes your site nav (in the demo site this is done using table markup), without including a level-0 (document) title. Include this header file right at the top in every page of your site. Then render by just running asciidoctor *.txt on your project.
--embedded option + simple post processing
With this option, asciidoctor generates only the interior part of the <body> element.
For example:
main.adoc
= Super title
== Second level
asdf
== Also second level
qwer
then:
asciidoctor --embedded main.adoc
produces:
main.html
<div class="sect1">
<h2 id="_second_level">Second level</h2>
<div class="sectionbody">
<div class="paragraph">
<p>asdf</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_also_second_level">Also second level</h2>
<div class="sectionbody">
<div class="paragraph">
<p>qwer</p>
</div>
</div>
</div>
You can then just cat a header and closing footer, and you are done.
Tested with Asciidoctor 2.0.10.

HTML - How to open an a href that leads to a div

So I have two separate HTML files. The first one holds a section with id="portfolio". The second one holds an a href. When I click the a href in the second HTML file I want to go to the first HTML file at the #porfolio section position. I know how to open the first HTML file from the a href. I also know how to get to the #porfolio section from the first HTML file. What I don't know is how can get to the #portfolio section in the first HTML file through the second HTML file. So how can I do that? Thanks in advance!
First HTML:
<section class="no-padding" id="portfolio">
...
</section>
Second HTML:
<a class="page-scroll" href="#portfolio">Portfolio</a>
This should work when included in second.html:
<a class="page-scroll" href="first.html#portfolio">Portfolio</a>
To clarify: you have 2 pages open in a webbrowser (the same webbrowser) and you want to jump back and forth between the 2 different pages, causing the web browser to change tabs/windows and re-display the requested page(s) at the anchor point you specify.
You need to talk to webbrowser and get it to do the work for you. The answer is browser specific.
I would start by creating child page (target='_blank') of original page and seeing what individual browsers allow you to get away with. Your mileage may vary, as they say.

Linking within a page with Bootstrap

I'm very confused about how linking to an element within a page works. I'm learning the starter template for Twitter Bootstrap, and it contains the following code in the navbar:
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
</ul>
I understand that within the list elements are anchor tags to #about and #contact, but where is the content defined for this? In the example site, the .starter-template div stays the same whenever I click the navbar buttons. What do I have to do to change the div whenever a navbar button is clicked? I tried doing this, but it just made a giant link as you would expect:
<a name="about">
<div class="container">
<div class="starter-template">
<h1>About.</h1>
<p class="lead">#about</p>
</div>
</div>
</a>
Thank you for any help!
~Carpetfizz
The links are placeholders. If you want to keep them the same, such as #about, you'd want to define an element in your page with that ID. For example, make a longer page, and include the following tag:
<h1 id="about">Here's the About Content</h1>
Clicking the link will jump to that spot in the page.
Wikipedia uses this approach to jump to sections in an article. For example, inspect the <span> tag containing the "See Also" text here:
http://en.wikipedia.org/wiki/Twitter_Bootstrap#See_also
However, since they are placeholders in the Bootstrap template, the idea is that you'll put in your own links as you see fit. For example, if you wanted to add a link to Yahoo, you'd enter your own HREF, like so:
Yahoo
Or target any other link in your site.
They're just placeholders. And if you want those targets to exist, you have to create the pages at the URLs they point to.
Such hash links can behave a little differently if you're developing a Single-page Application (SPA), but I think I've covered the simpler answer to what's confusing you. I.e., hash links attempt to jump to an ID within the page, but an element with that ID needs to exist for anything noticeable to occur.
This behavior is built into HTML; it's not something unique to using Bootstrap.