I am having an issue of an "a tag" displaying outside of the @RenderBody method when javascript is disabled. In the second result (Javascript disabled), the "a tag" is being added a second time with style attributes ('visiblity' and 'display') being automatically
added.
I attempted this using the exact same mark-up and the View rendered properly (the same as with Javascript disabled). What browser(s) are you experiencing this in? Is there any other code that could
possibly be conflicting with any of these?
I had the same train of thought earlier today. I was curious if 'NoScript' (the FF addin being used to toggle JS) might be causing it. However, when I created a simple html file and ran it in FF, the issue was not present. All displayed as it should.
Found the culprit, it was indeed the 'NoScript' addon. However, it's odd that the simple html file didn't have the same issue.
In case anyone runs into the same issue in future, it was being caused by a 'NoScript' accessibility feature?! (http://noscript.net/faq#qa3_17). "...any invisible link or button is forced to be displayed, unless at least one navigational
element is present."
A quick fix is to add any link with a width greater than 0 -- if you want it to be hidden, just make its opacity = 0 or visibility = hidden)
Anyway, big thank yous to those who were trying to help!
David Paylin...
0 Points
6 Posts
MVC RenderBody and display:none
Jan 26, 2013 07:31 PM|LINK
I am having an issue of an "a tag" displaying outside of the @RenderBody method when javascript is disabled. In the second result (Javascript disabled), the "a tag" is being added a second time with style attributes ('visiblity' and 'display') being automatically added.
Markup
LAYOUT MARKUP: --------------------------------------------------------------------------------------------- <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> </head> <body> <div id="main" style="display:none;"> @RenderBody() </div> </body> </html> PAGE MARKUP: --------------------------------------------------------------------------------------------- @{ ViewBag.Title = "Index"; } <a href="#" class="button">The button</a> RESULT WITH JAVASCRIPT ENABLED: --------------------------------------------------------------------------------------------- <!DOCTYPE html> <html> <head> <title>Index</title> </head> <body> <div id="main" style="display:none;"> <a class="button" href="#">The button</a> </div> </body> </html> RESULT WITH JAVASCRIPT DISABLED: --------------------------------------------------------------------------------------------- <!DOCTYPE html> <html> <head> <title>Index</title> </head> <body> <div id="main" style="display:none;"> <a class="button" href="#">The button</a> </div> <a class="button" href="#" style="visibility: visible; display: block;">The button</a> </body> </html>Rion William...
All-Star
26506 Points
4405 Posts
Re: MVC RenderBody and display:none
Jan 27, 2013 12:37 PM|LINK
I attempted this using the exact same mark-up and the View rendered properly (the same as with Javascript disabled). What browser(s) are you experiencing this in? Is there any other code that could possibly be conflicting with any of these?
<!DOCTYPE html /> <html> <head> <title>Index</title> </head> <body> <div id="main" style="display:none;"> <a href="#" class="button">The button</a> </div> </body> </html>CPrakash82
All-Star
18168 Points
2833 Posts
Re: MVC RenderBody and display:none
Jan 27, 2013 12:43 PM|LINK
With above code, I don't see any problem, it works like a charm for me, unless you have something else in your code or css/js.
David Paylin...
0 Points
6 Posts
Re: MVC RenderBody and display:none
Jan 27, 2013 03:13 PM|LINK
@Rion: I am seeing this behaviour in Firefox (v. 18.0.1)
@CPrakash: No css/js is being used (save the display:none), this is a very barebones example that illustrates the issue.
CPrakash82
All-Star
18168 Points
2833 Posts
Re: MVC RenderBody and display:none
Jan 27, 2013 03:34 PM|LINK
There is something otherwise you will not see this.
David Paylin...
0 Points
6 Posts
Re: MVC RenderBody and display:none
Jan 28, 2013 01:03 AM|LINK
Other than the code-behind, that is it. As I stated before, a very barebone example
Code Behind: ------------------------------------------------------------------------------------------------- public class DefaultController : Controller { public ActionResult Index() { return View(); } }David Paylin...
0 Points
6 Posts
Re: MVC RenderBody and display:none
Jan 28, 2013 01:26 AM|LINK
As you can see in the screenshots below, the "a tag" is being added
-------------------------------------------------------------------------------------------------------------------------------------------------------
With Javascript Enabled:
With Javascript Disabled:
bruce (sqlwo...
All-Star
36644 Points
5432 Posts
Re: MVC RenderBody and display:none
Jan 28, 2013 04:05 AM|LINK
David Paylin...
0 Points
6 Posts
Re: MVC RenderBody and display:none
Jan 28, 2013 04:39 AM|LINK
I had the same train of thought earlier today. I was curious if 'NoScript' (the FF addin being used to toggle JS) might be causing it. However, when I created a simple html file and ran it in FF, the issue was not present. All displayed as it should.
I am currently only seeing this issue in MVC.
David Paylin...
0 Points
6 Posts
Re: MVC RenderBody and display:none
Jan 28, 2013 05:31 AM|LINK
Found the culprit, it was indeed the 'NoScript' addon. However, it's odd that the simple html file didn't have the same issue.
In case anyone runs into the same issue in future, it was being caused by a 'NoScript' accessibility feature?! (http://noscript.net/faq#qa3_17). "...any invisible link or button is forced to be displayed, unless at least one navigational element is present."
A quick fix is to add any link with a width greater than 0 -- if you want it to be hidden, just make its opacity = 0 or visibility = hidden)
Anyway, big thank yous to those who were trying to help!