From 049d57e59279cc84d0dd23c8c8ff919edde8f14b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 2 Feb 2016 17:29:39 +0200 Subject: Fix FOUC effect in Firefox caused by autofocus --- brep/mod-package-details.cxx | 9 +++++++++ brep/mod-package-search.cxx | 9 +++++++++ web/xhtml | 43 ++++++++++++++++++++++--------------------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/brep/mod-package-details.cxx b/brep/mod-package-details.cxx index 2c7c04d..f2f8bd6 100644 --- a/brep/mod-package-details.cxx +++ b/brep/mod-package-details.cxx @@ -119,6 +119,15 @@ handle (request& rq, response& rs) s << ~TITLE << CSS_LINKS (path ("package-details.css"), root) + // + // This hack is required to avoid the "flash of unstyled content", which + // happens due to the presence of the autofocus attribute in the input + // element of the search form. The problem appears in Firefox and has a + // (4-year old, at the time of this writing) bug report: + // + // https://bugzilla.mozilla.org/show_bug.cgi?id=712130. + // + << SCRIPT << " " << ~SCRIPT << ~HEAD << BODY << DIV_HEADER (root) diff --git a/brep/mod-package-search.cxx b/brep/mod-package-search.cxx index d649ff4..b283a5b 100644 --- a/brep/mod-package-search.cxx +++ b/brep/mod-package-search.cxx @@ -112,6 +112,15 @@ handle (request& rq, response& rs) s << ~TITLE << CSS_LINKS (path ("package-search.css"), root) + // + // This hack is required to avoid the "flash of unstyled content", which + // happens due to the presence of the autofocus attribute in the input + // element of the search form. The problem appears in Firefox and has a + // (4-year old, at the time of this writing) bug report: + // + // https://bugzilla.mozilla.org/show_bug.cgi?id=712130. + // + << SCRIPT << " " << ~SCRIPT << ~HEAD << BODY << DIV_HEADER (root) diff --git a/web/xhtml b/web/xhtml index d1d2044..462d302 100644 --- a/web/xhtml +++ b/web/xhtml @@ -299,27 +299,28 @@ namespace web }; static const css_style_element CSS_STYLE; - static const element BODY ("body"); - static const element DIV ("div"); - static const element FORM ("form"); - static const element H1 ("h1"); - static const element H2 ("h2"); - static const element H3 ("h3"); - static const element H4 ("h4"); - static const element H5 ("h5"); - static const element H6 ("h6"); - static const element LI ("li"); - static const element LINK ("link"); - static const element META ("meta"); - static const element P ("p"); - static const element PRE ("pre"); - static const element TABLE ("table"); - static const element TBODY ("tbody"); - static const element TD ("td"); - static const element TH ("th"); - static const element TITLE ("title"); - static const element TR ("tr"); - static const element UL ("ul"); + static const element BODY ("body"); + static const element DIV ("div"); + static const element FORM ("form"); + static const element H1 ("h1"); + static const element H2 ("h2"); + static const element H3 ("h3"); + static const element H4 ("h4"); + static const element H5 ("h5"); + static const element H6 ("h6"); + static const element LI ("li"); + static const element LINK ("link"); + static const element META ("meta"); + static const element P ("p"); + static const element PRE ("pre"); + static const element SCRIPT ("script"); + static const element TABLE ("table"); + static const element TBODY ("tbody"); + static const element TD ("td"); + static const element TH ("th"); + static const element TITLE ("title"); + static const element TR ("tr"); + static const element UL ("ul"); static const inline_element A ("a"); static const inline_element B ("b"); -- cgit v1.1