This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit fa815e90f4b401eba3c81169151b9be36fa80d3f Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 3 09:17:35 2021 +0200 refs #108 handle keyboard navigation in the carousel --- .../src/main/web/tag/popup/ChoiceDetailModal.tag.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/ChoiceDetailModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/ChoiceDetailModal.tag.html index 9c19b5e5..d123c3f6 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/ChoiceDetailModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/ChoiceDetailModal.tag.html @@ -24,7 +24,8 @@ import "../components/MultiLineLabel.tag.html"; ref="modal" only-ok="true"> - <div if={parent.choice && parent.choice.choiceType === "RESOURCE" && parent.meta} class="resource-container"> + <div if={parent.choice && parent.choice.choiceType === "RESOURCE" && parent.meta} + class="resource-container"> <a if={parent.resourceChoices.length > 1} class="carousel-button" onclick="{parent.previousResource}"> @@ -73,6 +74,8 @@ import "../components/MultiLineLabel.tag.html"; this.resourceChoices = []; this.loading = false; + document.addEventListener("keydown", event => this.handleKeyPress(event)); + this.onPollChange = poll => { this.resourceChoices = poll.questions[0].choices.filter(choice => choice.choiceType === "RESOURCE"); }; @@ -92,6 +95,16 @@ import "../components/MultiLineLabel.tag.html"; return promise; }; + this.handleKeyPress = event => { + if (event.keyCode === 37) { + event.preventDefault(); + this.previousResource(); + } else if (event.keyCode === 39) { + event.preventDefault(); + this.nextResource(); + } + }; + this.nextResource = () => { let choiceIndex = this.resourceChoices.indexOf(this.choice); this.setResource((choiceIndex + 1) % this.resourceChoices.length); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.