Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed actions button around wrapper text input and tried to add focus on wrapper #6344

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/volto-slate/src/blocks/Text/keyboard/cancelEsc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
export const cancelEsc = ({ editor, event }) => {
// TODO: this doesn't work, escape canceling doesn't work.
const props = editor.getBlockProps();
const { onSelectBlock, onSelectWrapper, id, blockNode } = props;

Check warning on line 3 in packages/volto-slate/src/blocks/Text/keyboard/cancelEsc.js

View workflow job for this annotation

GitHub Actions / ESlint

'onSelectBlock' is assigned a value but never used

event.stopPropagation();
event.nativeEvent.stopImmediatePropagation();
event.preventDefault();
return true;

onSelectWrapper(blockNode.current.parentNode, id);
// onSelectBlock(id, true, event); // selection with active buttons doesn't work

/* 1. the first focus should go on the outer wrapper
2. with the tab key you have the possibility to rotate the various buttons,
3. at the fourth tab you have the focus again on the wrapper,
4. to enter the slate input field press Enter
5. otherwise you move with the arrows keys */
};
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ export function goDown({ editor, event }) {
export function traverseBlocks(opts) {
const { event } = opts;
event.preventDefault();
// return event.shiftKey ? goUp(opts) : goDown(opts);
return true;
//return event.shiftKey ? goUp(opts) : goDown(opts);
return false;
}
5 changes: 5 additions & 0 deletions packages/volto/locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4492,6 +4492,11 @@ msgstr "La vostra sol·licitud de restabliment de la contrasenya s'ha enviat per
msgid "draft"
msgstr "Esborrany"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4491,6 +4491,11 @@ msgstr "Der Link, um das Passwort neu zu setzen, wurde Ihnen zugesendet. Die E-M
msgid "draft"
msgstr "Entwurf"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr "Drag & Drop-Block"

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4486,6 +4486,11 @@ msgstr ""
msgid "draft"
msgstr ""

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4493,6 +4493,11 @@ msgstr "Se han enviado las instrucciones para restablecer su contraseña. Deben
msgid "draft"
msgstr "Borrador"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4493,6 +4493,11 @@ msgstr "Pasahitza berrezartzeko eskaera e-postaz bidali dizugu. Momentu batetik
msgid "draft"
msgstr "Zirriborroa"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4491,6 +4491,11 @@ msgstr "Lähetimme sinulle sähköpostilla ohjeet salasanan vaihtamiseksi. Sen p
msgid "draft"
msgstr "luonnos"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4493,6 +4493,11 @@ msgstr "Mot de passe envoyé"
msgid "draft"
msgstr "Brouillon"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr "glisser-déposer le bloc"

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/hi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4486,6 +4486,11 @@ msgstr "आपका पासवर्ड रीसेट अनुरोध
msgid "draft"
msgstr "ड्राफ़्ट"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4486,6 +4486,11 @@ msgstr "La istruzioni per reimpostare la tua password sono state inviate. Dovreb
msgid "draft"
msgstr "Bozza"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr "blocco drag and drop"

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/ja/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4491,6 +4491,11 @@ msgstr "パスワード再設定のお願いをメール送信しました。ま
msgid "draft"
msgstr "下書き(draft)"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4490,6 +4490,11 @@ msgstr ""
msgid "draft"
msgstr ""

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/pt/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4491,6 +4491,11 @@ msgstr "descrição_senha_enviada"
msgid "draft"
msgstr ""

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/pt_BR/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4492,6 +4492,11 @@ msgstr "Sua solicitação de redefinição de senha foi enviada. Ela deve chegar
msgid "draft"
msgstr "Rascunho"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/ro/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4486,6 +4486,11 @@ msgstr "Parola este în curs de schimbare. Urmați instrucțiunile primite pe ad
msgid "draft"
msgstr "proiect"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
7 changes: 6 additions & 1 deletion packages/volto/locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-08-10T17:00:27.117Z\n"
"POT-Creation-Date: 2024-09-26T19:13:52.821Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down Expand Up @@ -4488,6 +4488,11 @@ msgstr ""
msgid "draft"
msgstr ""

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/zh_CN/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -4492,6 +4492,11 @@ msgstr "您的密码重置请求邮件已发送。稍后它将到达您的邮箱
msgid "draft"
msgstr "草案"

#. Default: "drag and drop block"
#: components/manage/Blocks/Block/EditBlockWrapper
msgid "drag and drop block"
msgstr ""

#. Default: "Input must be valid email ([email protected])"
#: helpers/MessageLabels/MessageLabels
msgid "email"
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/6344.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fixed actions button around wrapper text input and tried to add focus on wrapper @SaraBianchi @Wagner3UB
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ const BlocksForm = (props) => {
</EditBlockWrapper>
);

const onSelectWrapper = (blockNode, blockIndex) => {
return blockNode.focus();
};

const editBlockWrapper = children || defaultBlockWrapper;

// Remove invalid blocks on saving
Expand Down Expand Up @@ -340,6 +344,7 @@ const BlocksForm = (props) => {
onMoveBlock,
onMutateBlock,
onSelectBlock,
onSelectWrapper,
pathname,
metadata,
properties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const messages = defineMessages({
id: 'delete',
defaultMessage: 'delete',
},
dragAndDrop: {
id: 'drag and drop block',
defaultMessage: 'drag and drop block',
},
});

const EditBlockWrapper = (props) => {
Expand Down Expand Up @@ -82,18 +86,23 @@ const EditBlockWrapper = (props) => {
})}
>
<div style={{ position: 'relative' }}>
<div
style={{
visibility: visible ? 'visible' : 'hidden',
display: 'inline-block',
}}
{...draginfo.dragHandleProps}
className="drag handle wrapper"
>
<Icon name={dragSVG} size="18px" />
</div>
<div className={`ui drag block inner ${type}`}>
{children}
{/* Drag&Drop button */}
<Button
icon
basic
style={{
visibility: visible ? 'visible' : 'hidden',
display: 'inline-block',
}}
{...draginfo.dragHandleProps}
className="drag handle wrapper"
aria-label={intl.formatMessage(messages.dragAndDrop)}
>
<Icon name={dragSVG} size="18px" />
</Button>

{/* Delete button */}
{selected && !required && editable && (
<Button
icon
Expand All @@ -105,6 +114,8 @@ const EditBlockWrapper = (props) => {
<Icon name={trashSVG} size="18px" />
</Button>
)}

{/* Add button */}
{config.experimental.addBlockButton.enabled && showBlockChooser && (
<BlockChooserButton
data={data}
Expand Down Expand Up @@ -140,6 +151,12 @@ const EditBlockWrapper = (props) => {
contentType={contentType}
/>
)}

{/* Blocks */}
{/* eslint-disable-next-line */}
<div role="region" className="block-wrapper" tabIndex="0">
{children}
</div>
</div>
</div>
</div>
Expand Down
Loading