fix(navegacao): foco em âncora de outra página, vitrine acessível e 3D mais leve
Foco cai no destino ao chegar de outra página; âncoras ignoram ?tipo=; movimento reduzido salta em todos os cliques; cronômetro da janela ampliada; degradê no topo de Projetos e legendas do mergulho com intervalos testados; vitrine acima da barra de cookies e com 2 paradas por projeto; reel-list.css no global; 3D montado em tarefas curtas, limitado a ~30 qps e estático com WebGL por software; pôsteres da vitrine de 330 para 158 KB; SC Plus regravado; scripts sem funções acima de complexidade 10.
This commit is contained in:
1 parent
9e2d65a926
commit
204ebd5fa5
49 files changed
+2197
-606
No files matched your search
@@ -43,6 +43,45 @@ describe("useFocusOnNavigation", () => {
|
||||
expect(focus).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
describe("with a #hash in the URL (from /privacidade to /#contact)", () => {
|
||||
afterEach(() => {
|
||||
window.history.replaceState(null, "", "/");
|
||||
});
|
||||
|
||||
function mountContact() {
|
||||
const contact = document.createElement("section");
|
||||
contact.id = "contact";
|
||||
contact.tabIndex = -1;
|
||||
document.body.append(contact);
|
||||
return contact;
|
||||
}
|
||||
|
||||
it("leaves the focus to the anchor target when the new page has it", () => {
|
||||
const main = mountMain();
|
||||
const contact = mountContact();
|
||||
const focus = jest.spyOn(main, "focus");
|
||||
const { rerender } = render(<Probe pathname="/privacidade" />);
|
||||
|
||||
window.history.replaceState(null, "", "/#contact");
|
||||
contact.focus({ preventScroll: true });
|
||||
rerender(<Probe pathname="/" />);
|
||||
|
||||
expect(focus).not.toHaveBeenCalled();
|
||||
expect(contact).toHaveFocus();
|
||||
});
|
||||
|
||||
it("still focuses #main-content when the hash points to nothing on the new page", () => {
|
||||
const main = mountMain();
|
||||
mountContact();
|
||||
const { rerender } = render(<Probe pathname="/privacidade" />);
|
||||
|
||||
window.history.replaceState(null, "", "/#nada");
|
||||
rerender(<Probe pathname="/" />);
|
||||
|
||||
expect(main).toHaveFocus();
|
||||
});
|
||||
});
|
||||
|
||||
it("still tells a navigation from the first load when the component remounts (first segment changed)", () => {
|
||||
const main = mountMain();
|
||||
const first = render(<Probe pathname="/" />);
|
||||
|
||||
Reference in new issue
Block a user