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

Change data-id to data-shepherd-step-id on Step content elements. #282

Merged
merged 1 commit into from
Oct 22, 2018
Merged
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
2 changes: 1 addition & 1 deletion src/js/step.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class Step extends Evented {
_createTooltipContent() {
const content = document.createElement('div');
const classes = this.options.classes || '';
const element = createFromHTML(`<div class='${classes}' data-id='${this.id}' id="step-${this.options.id}-${uniqueId()}"}>`);
const element = createFromHTML(`<div class='${classes}' data-shepherd-step-id='${this.id}' id="step-${this.options.id}-${uniqueId()}"}>`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good w/ removing the ID attr, but since with multiple tours we can have shared ids, can we do something to make sure this value is unique?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chuckcarpenter I think we should have a single data-shepherd-step-id attr that does what id is currently doing.

Is that what you're suggesting?

Copy link
Contributor Author

@BrianSipple BrianSipple Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then again, do we need uniqueness here?

We were discussing having a data-shepherd-active-tour attribute on the body. If we implement that, someone could always use it as the context for querying unique steps -- even if steps share ids across tours.

Copy link
Contributor Author

@BrianSipple BrianSipple Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chuckcarpenter @rwwagner90 To summarize, I'm thinking we merge this PR as-is, then open up another issue for adding data-shepherd-active-tour attribute to the body and removing the extra id attribute on steps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we have current tour on the body, so that solves the specificity issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chuckcarpenter Where are you seeing that? I'm thinking we still need to implement it. Right now, it looks like we're just indicating the current step:

screen shot 2018-10-22 at 4 01 26 pm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right. It's in the BM frontend right now.

// TODO: add this in Shepherd.js
document.body.setAttribute('data-shepherd-active-tour', tourName);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said, should the tour id be part of the ID for the step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const header = document.createElement('header');

if (this.options.title) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test.step.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Tour | Step', () => {
it('shows step evoking method, regardless of order', () => {
showTestStep.show();

assert.equal(document.querySelector('[data-id=test2]').dataset.id, 'test2');
assert.exists(document.querySelector('[data-shepherd-step-id=test2]'));
});
});
});
Expand Down